Jump to content

How to create Apache access log each month automatically


TFT2012

Recommended Posts

Hi all,

 

Are we able to make Apache create the access_log each month automatically? I tried like this:

CustomLog "logs/access/access_log_%{year_month}t" common

 

or

 

CustomLog "logs/access/access_log_%Year-%month" common

 

or

 

CustomLog "logs/access/access_log_%Y-%m" common

 

But it returns me the file name just like " access_log_%{year_month}t ".

 

Can anyone help?

 

Thanks a lot.

Had you looked at the manual before blindly trying random things you would have seen a note about piped logs. Related, here is the manual page for rotatelogs which demonstrates how you can have a daily log file; I think it will append to existing files so you could write the filename to be per-month and use a per-hour interval (to handle DST changes).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.