Reason why rotatelogs worked the first night but not again?
under the #Log file locations section in my virtual host config I originally had the following code:
CustomLog /home/user/public/mysite.com/log/access.log combined
Per the instructions from the apache docs in the above link I changed this code to:
CustomLog "| /usr/sbin/rotatelogs /home/user/public/mysite.com/log/access.log.%Y-%m-%d 86400" combined
Now it worked perfectly the first night. I checked the log folder at like 12:30 am and there was indeed a new access log file created called access.log.2014-09-20 But when I checked the log folder just now there is no new access log file for today. So yeah there is no access.log.2014-09-21 in my log folder. It was my understanding that adding 86400 would result in the creation of daily logs at midnight.
Any ideas as to what could have caused the program to not make a new log?
2 Replies
All the examples don't have a space between the pipe symbol and the path to the program, while your configuration does. I don't know if this makes any difference or not.
The rotation is done at midnight UTC rather than local time (unless you specify the -l option or an offset value, which you haven't). So it may be happening at a different time than you expect.
> - The rotation is done at midnight UTC rather than local time (unless you specify the -l option or an offset value, which you haven't). So it may be happening at a different time than you expect.
You were right, it was the UTC time thing. For some reason I thought I was setting the time based on the server time zone or something. So the good news is that rotatelogs is working, it's just not working at the time I thought it would.
I'll look into adjusting the time with the -l option, etc.
Thanks.