The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Raw log files rotated twice at end of month

Discussion in 'General Discussion' started by cycletourist, May 2, 2006.

  1. cycletourist

    cycletourist Member

    Mar 20, 2003
    Likes Received:
    Trophy Points:
    I'm not sure if I am addressing this properly, but ....

    I have written Php scripts to read the Apache access logs on my remote server (via cPanel) and enter them into a database on my home computer.

    I access them from the script by opening the URL (file) at cPanel - Raw Log File.

    This works fine every day until the end of the month when the log files are rotated twice - once on the day before the last day of the month and again on the last day of the month.

    That's my bottom line question. Is this done by cPanel? And if so, why? Can it be changed somehow - - - through some sort of configuration?

    Rotating (if I am using that term correctly) the raw log files twice at the end of the month presents a real problem for my script. It's complicated, but it makes accessing every last log entry for a month a complicated issue (requiring manual intervention).

    If you care to understand ... read on ....

    I read my access logs at 2am. So, on April 28 at 2 AM I read the logfile containing entries from April 1 to 2am on April 28. All is okay.

    On April 29 I read the logfile at 2am, but it has been rotated (one day early) and now begins at midnight of the 29th and ends at 2am (a very brief logfile). I am now missing the log entries from all day on the 28th - from 2am April 28th until midnight, when it became April 29th and the log file was rotated (I think I'm using that term right).

    That's fine. All of April's entries are archived that night into an "April archive file." I can merely read that archived logfile (I have enabled that option) and it will have all then entries I missed.

    The problem is that it happens again at 2AM on April 30th. (Rather ... the problem is that it had already happened one day too early). Now I have another very brief logfile (midnight to 2am on the 30th), that is lacking all data from 2am the previous day until midnight when it became the 30th. The previous archive file for April is now overwritten to include the one last day.

    And therein lies the problem. I have to ignore the first April archive file while this mess sorts itself out, or else I will read the entries I missed on the 28th twice (when I read the archive file created at midnight on the 29th and when I read the new archive file created on the 30th).

    So ..... with all that complication, whether you understood or not, the bottom line is:

    Why does cPanel (or whoever is doing it) rotate the logfiles on the second to the last day of the month AND the last day of the month? (My web host has indicated that cPanel does this.)

    If it waited until the actual last day of the month, I would not have this issue (that requires manual intervention at the end of every month).


    So, is it cPanel that's doing that? And if so, can it be changed?

    Chuck Anderson
    #1 cycletourist, May 2, 2006
    Last edited: May 2, 2006

Share This Page