Friday, January 13, 2017

Piped logging program to rotate Apache logs


This creates the files logs\access_yyyy_mm_dd.log where yyyy is the year, mm is the month, and dd is the day of the month. Logging will switch to a new file every day at midnight, local time for xampp in windows.

Solution:
Changed in xampp\apache\conf\httpd.conf

CustomLog "|bin/rotatelogs.exe -l logs/access_%Y_%m_%d.log 86400" common

option used
-l Causes the use of local time rather than GMT as the base for the interval or for strftime(3) formatting with size-based rotation.
%Y 4-digit year
%m 2-digit month
%d 2-digit day of month
rotationtime The time between log file rotations in seconds.


Reference: http://httpd.apache.org/docs/current/programs/rotatelogs.html