joachim
02-18-2002, 06:54 PM
Hello,
i run webalizer 2 on my server with 2 cron jobs.
i filter via grep the domain name out of the access_log file, the other is the webalizer comand.
Like
grep -i "domain-name" /var/log/httpd/access_log >/var/www/sites/www.domain-name/stats/domain-namedatafile
however, since afer 2 days, I have
access_log
access_log.1
access_log.2 and so on, this doens´t work for a longer time. Any idea?
thanks in advance,
Joachim
freakysid
02-19-2002, 07:09 PM
Your system is rotating the log file for apache. You probablyl have the a cron job to run logrotate in your cron.daily folder. Look for (linux):
/etc/cron.daily/logrotate
Your logrotate config file should be in:
/etc/logrotate.conf
You need to check in there what rules have been set for the log rotation - is it every day, or after the file reaches a certain size?
You can:
1) remove your access_log from the logrotate.conf file.
2) Ensure rotate is set to happen daily, then modify your log filtering cron job to suite. Make sure it happens after logrotate has run, and take the content of yesterday's log file which will be access_log.1 and append your grepped output to your filtered log file:
grep -i "domain-name" /var/log/httpd/access_log.1 >> /var/www/sites/www.domain-name/stats/domain-namedatafile
UnifiedCons
02-20-2002, 03:10 AM
Originally posted by joachim
Hello,
i run webalizer 2 on my server with 2 cron jobs.
i filter via grep the domain name out of the access_log file, the other is the webalizer comand.
Like
grep -i "domain-name" /var/log/httpd/access_log >/var/www/sites/www.domain-name/stats/domain-namedatafile
however, since afer 2 days, I have
access_log
access_log.1
access_log.2 and so on, this doens´t work for a longer time. Any idea?
thanks in advance,
Joachim
Joachim:
To do all of the access_log files, try this command:
rm /var/www/sites/www.domain-name/stats/domain-namedatafile;
for i in `ls /var/log/httpd/access_log*`; do grep -i "domain-name" $i >> /var/www/sites/www.domain-name/stats/domain-namedatafile; done
This will delete the current log file for that domain, then go through each access_log and grep out the stuff you want. You can put all of that on one line with the semicolons. Note that those are backticks (usually on the ~ key) around the ls command.
joachim
04-05-2002, 04:00 PM
Thanks, it worked.
Joachim