Go Back   Garayed.com > Apache Configurations
Reply
 
LinkBack Thread Tools Search this Thread Display Modes

rotatelogs: log name is one day off
  #1 (permalink)  
Old 02-08-2010, 07:27 PM
i5mast
 
Posts: n/a
Default rotatelogs: log name is one day off

Hello, I have the following configuration.
OS: CentOS release 5.4 (Final)
Server version: Apache/2.2.14 (Unix)
Server built: Oct 26 2009 06:33:38
Cpanel::Easy::Apache v3.2.0 rev4801

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #2 (permalink)  
Old 02-08-2010, 07:51 PM
Luuk
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

Op 8-2-2010 21:27, i5mast schreef:
> Hello, I have the following configuration.
> OS: CentOS release 5.4 (Final)
> Server version: Apache/2.2.14 (Unix)
> Server built: Oct 26 2009 06:33:38
> Cpanel::Easy::Apache v3.2.0 rev4801
>
> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #3 (permalink)  
Old 02-08-2010, 08:14 PM
i5mast
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

On Feb 8, 3:51*pm, Luuk <l...@invalid.lan> wrote:
> 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.......


It does say that it rotates at midnight http://httpd.apache.org/docs/2.2/pro...otatelogs.html

--
i5mast

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #4 (permalink)  
Old 02-08-2010, 08:28 PM
Luuk
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

Op 8-2-2010 22:14, i5mast schreef:
> On Feb 8, 3:51 pm, Luuk <l...@invalid.lan> wrote:
>> 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.......

>
> It does say that it rotates at midnight http://httpd.apache.org/docs/2.2/pro...otatelogs.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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #5 (permalink)  
Old 02-08-2010, 09:01 PM
i5mast
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

On Feb 8, 4:28*pm, Luuk <l...@invalid.lan> wrote:
> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #6 (permalink)  
Old 02-08-2010, 09:13 PM
Luuk
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

Op 8-2-2010 23:01, i5mast schreef:
> On Feb 8, 4:28 pm, Luuk <l...@invalid.lan> wrote:
>> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #7 (permalink)  
Old 02-09-2010, 09:06 AM
Luuk
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

Op 8-2-2010 23:01, i5mast schreef:
> /etc/logrotate.d is not an option for me. It does not keep all log
> files
>
> --
> i5mast



"/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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #8 (permalink)  
Old 02-09-2010, 08:18 PM
i5mast
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

On Feb 9, 5:06*am, Luuk <l...@invalid.lan> wrote:
> Op 8-2-2010 23:01, i5mast schreef:
>
> > /etc/logrotate.d is not an option for me. It does not keep all log
> > files

>
> > --
> > *i5mast

>
> "/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


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #9 (permalink)  
Old 02-10-2010, 07:13 AM
Álvaro G. Vicario
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

El 09/02/2010 22:18, i5mast escribió/wrote:
> On Feb 9, 5:06 am, Luuk<l...@invalid.lan> wrote:
>> Op 8-2-2010 23:01, i5mast schreef:
>>
>>> /etc/logrotate.d is not an option for me. It does not keep all log
>>> files

>>
>>> --
>>> i5mast

>>
>> "/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

>
> 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


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
--
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: rotatelogs: log name is one day off
  #10 (permalink)  
Old 02-24-2010, 07:06 PM
i5mast
 
Posts: n/a
Default Re: rotatelogs: log name is one day off

On Feb 8, 3:27*pm, i5mast <mstrum...@gmail.com> wrote:
> Hello, I have the following configuration.
> OS: CentOS release 5.4 (Final)
> Server version: Apache/2.2.14 (Unix)
> Server built: * Oct 26 2009 06:33:38
> Cpanel::Easy::Apache v3.2.0 rev4801
>


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:16 AM.


Powered by vBulletin® Version 3.5.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
| Home | FAQ | Members List | Calendar | Today's Posts | Search | New Posts |