Setting up webalizer for virtual host
Hi I have webalizer installed on my server and this server has 2 virtualhost (called A&B). I have setup access_logA & access_logB for each of them. Now, how do I use webalizer to monitor these 2 vHost? . How many files do I need to edit to make it work? I want after everything is setup, I can type http://www.SiteA/webalizer/ & http://www.SiteB/webalizer/ to monitor each site seperately.
Thanks |
edit '/etc/cron.daily/webalizer':
Code:
if [ -s /var/log/access_logA ] ; then Basically, you are executing webalizer for each domain, with their individual settings. Enjoy. JN |
So do you mean just copy file webalizer.conf 2 times with different name(for 2 vHosts) and edit line:
LogFile /path/to/file/logs/access_logA (for SiteA) and LogFile /path/to/file/logs/access_logB (for SiteB) (and few more lines :p) and edit the cron like you said? Thanks |
Here are parts two of the webalizer files I am currently using:
Example A (webalizer_domaina.conf): Code:
LogFile /var/log/access_logA Code:
LogFile /var/log/access_logB [code]if [ -s /var/log/access_logA ] ; then /usr/bin/webalizer -c /var/www/html/donmaina/webalizer/webalizer_domainb.conf fi if [ -s /var/logs/access_logB ] ; then /usr/bin/webalizer -c /var/www/html/donmainb/webalizer/webalizer_domainb.conf fi |
Thanks a lot. I'll try when I get home.
|
It works but I have another question:
How do I CLEAR log file(access_log) after running this cron job? I mean delete all record to set log file to 0KB Thanks |
You can do it in the /etc/cron.daily/webalizer file. Why would you want to delete your logs? You can modify the logrotate conf file (see 'man logrotate') to rotate your access logs. This way they will stay manageable.
Enjoy. JN |
I mean the log file will get bigger everday. So to keep the room for the hard drive, I want to clean it after webalizer take the record. For example, today, the log file is 1MB and it will be 2 MB by tomorrow. If I can take the record and clear the log file it will be only 1 MB by tomorrow. Not sure if I understand it right. :p Did I miss something?
For about rotaring log file, does it mean after get reading, rename that file with a new name (ie. access_log.1) and create new file(ie. access_log) with 0 record? |
Yup.
Logrotate will evaluate the current log file. If it is over a certain size, or certian unmodified age, it rotates it. *.4 gets deleted, *.3 becomes *.4 .... until current log becomes *.1 and is deleted to 0 records. This way, you will always have history (more than 1 day) and your log files will not get too far out of hand. I keep mine to 4 logs and 150 days. Yes, they do get big, but I am better able to monitor when I have problems. The webalizer is used for stat purposes, but the log files are used for trouble shooting purposes. JN |
Thanks, it makes sence now. :D Before, I see the access_log changed to access_log.1 and the new file is created with 0KB but I don't realy know how it works. :p
So for the Logrotate which file should I need to edit/config? and will it effect to the webalizer? For example, if I setup cron job to run webalizer at midnight, how am I going to setup Logrotate (or what ever) to NOT missing any report of webalizer? |
I changed /etc/logrotate.d/httpd to:
Code:
/var/log/httpd/*log { Enjoy. JN |
1. I checked the webalizer file in cron.daily and YES, I see it named 00webalizer.conf
2. For the apache, If I have 2(or more) log files which are stored on different location, shall I change the /etc/logrotate.d/httpd to something like: Code:
/path/to/log/FILE1 { Thanks |
You could. That would create lots of headaches for any additional virtual servers. I currently host 5 websites, each with their own virtual server. I have placed the * so that I don't have to modify the logrotate file each time. I just add a new log file and the logrotate takes care of the rest for me.
Where the * is, the logrotate program will rotate each condition that matches it. Hope that helps. Enjoy. JN |
Thanks a lot.
|
Just 1 last question(I hope :D); if my httpd logs files store at /path/to/mylogs/ and in this folder has both http & ftp log files, when I run command /path/to/mylogs/*log will it procsess both ftp & http log files or just http log files?
Thanks |
logrotate will rotate all *log files. So if your ftp logs are named *log, then yes it will rotate them. As for the webalizer, you should name each log file individually, so is shouldn't matter what else is in the directory.
|
I have a problem with FTP log.
1. Does Webalizer support ProFTPD log file? 2. If it does, what is the correct format for log file? Thank you |
Webalizer will evaluate any log files. You will need to visit www.webalizer.com for instructions on how to use it. Webalizer is versatile enough to monitor mouse log files (that is if you log your mouse movements). You just have to tell it what to look for and how to catalog the information.
Enjoy. JN |
hey guys..this threat has helped me with my question..however im just confused on 1 thing...in your example u called the folder webalizer so users can view the stat at domain.com/webalizer i called mine stats....what are should the perms and ownership be for that file...and then webalizer runs should it create those webalizer files in that folder automatically? i tried running webalizer by typing /usr/bin/webalizer in the command line and nothing was generated
im running fedora2 thanks lenny |
All times are GMT -5. The time now is 06:04 AM. |