I have a virtual host configured in httpd.conf
CustomLog "|/usr/local/apache/bin/rotatelogs -l /usr/local/apache/logs/
accesslog_%Y_%m_%d.log 86400" combined
ErrorLog "|/usr/local/apache/bin/rotatelogs -l /usr/local/apache/logs/
errorlog_%Y_%m_%d.log 86400"
My issue is that accesslog and errorlog files are named
usr/local/apache/logs/accesslog_2010_02_07.log
/usr/local/apache/logs/errorlog_2010_02_07.log
Today's date is
# date
Mon Feb 8 15:18:25 EST 2010
So I expect the files to be named accesslog_2010_02_08.log and
errorlog_2010_02_08.log. If I set the rotation time to 86300 then
dates are ok.
Does anybody know what is going on? I have Apache 2.2.9 on Solaris 10
x86 and I have no problems with rotatelogs there.
Thank you.
This rotatelogs with 86400 is probably OK.
It means that log are rotated every 86400 seconds.
But it does not state WHEN, as on what time during this 86400 seconds,
this will happen.......
--
Luuk
It does say that it rotates at midnight http://httpd.apache.org/docs/2.2/programs/rotatelogs.html
--
i5mast
But is also says this:
This creates the files /var/logs/logfile.nnnn where nnnn is the system
time at which the log nominally starts (this time will always be a
multiple of the rotation time, so you can synchronize cron scripts with
it). At the end of each rotation time (here after 24 hours) a new log is
started.
I have my log configured like:
CustomLog /var/log/apache2/access_log combined
and my /etc/logratate.d/apache2 script is configured to rotatie the logs...
--
Luuk
I'm not sure what you're trying to say in the post above. The log
files _are_ being rotated at midnight. I can see that right now. I'm
using -l option to use a local timezone instead of UTC. The issue is
that the date in the name of the log file is off.
For example, accesslog_2010_02_06.log has _only_ http requests dated 7/
Feb/2010, accesslog_2010_02_07.log has only http requests dated 8/Feb/
2010.
If I started my Apache right now at 5:00pm EST, a log file name would
have a date of yesterday which is wrong. It should use current year,
month and day. This is how my other configuration behaves (Apache
2.2.6 actually).
/etc/logrotate.d is not an option for me. It does not keep all log
files :(
--
i5mast
hmmm, ok i see......
I can live with a logfile name 2010_02_06 which only containts logs from
7 feb 2010, thats why i never ever thought about this 'problem'
(because its no problem to /me)
;-)
i hope someone else has good suggestions for you
--
Luuk
"/var/log/httpd/access.log" /var/log/httpd/error.log {
rotate 999999
daily
postrotate
/sbin/killall -HUP httpd
endscript
}
will keep all logfiles, but they wont contain a data in the filename
--
Luuk
I have several VirtualHosts and each of them has CustomLog and
ErrorLog. VirtualHosts are added thru CPanel's console and its
template system. I can tweak the templates to have the desired
CustomLog and ErrorLog. I don't event want to think about the kung-fu
required to maintain /etc/logrotate.d this way :)
Regards,
--
i5mast
If I recall correctly, you can use wildcards. But, of course, once
Cpanel is involved you're pretty limited in almost everything :)
--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
I think I got to the bottom (almost) of this issue. The issue is that
system calls localtime/gmtime(t) give me incorrect time. Given this
perl script:
#!/usr/local/bin/perl
use POSIX qw(strftime);
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime(1266969600);
print $now_string."\n";
# or for GMT formatted appropriately for your locale:
$now_string = strftime "%a %b %e %H:%M:%S %Y", gmtime(1266969600);
print $now_string."\n";
I get the following:
Tue Feb 23 18:59:36 2010
Tue Feb 23 23:59:36 2010
I expect to see this:
Tue Feb 23 19:00:00 2010
Wed Feb 24 00:00:00 2010
The time is off by 24 seconds. Any ideas? Maybe hardware clock is off?
--
i5mast
Since Januari 1st, 1970 the net count of leap seconds is 24 ...
http://en.wikipedia.org/wiki/Leap_second
Your CentOS appears to be using a LeapSecond aware TimeZone setting, compare
the two results of
$ TZ=CET date; TZ=right/CET date;
# TZ=CET date && TZ=right/CET date
Thu Feb 25 20:03:35 CET 2010
Thu Feb 25 20:03:11 CET 2010
Yes, that was the issue. Thank you.