Search code examples
apacheloggingapache-config

Setting error log filename in apache to include current date


I'm trying to have apache create a new error log file every day, based on the current date. The default error log filename is something like this: ErrorLog "/logs/error.log"

and I want it to be something like: ErrorLog "/logs/error_$year$month$day.log"

Any ideas?


Solution

  • Take a look at Cronolog

    cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened. cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs.