Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my Linux/Apache server the access_log logs are rotated so that the logs from the last 5 days are kept (access_log.1, access_log.2, etc.)

How do I change this scheme in order to keep more than 5 days?

share|improve this question
    
What is the log rotation mechanism used. Is it default log rotation provided by apache or systems logrotate program? –  viky Jun 2 '09 at 11:50

4 Answers 4

up vote 4 down vote accepted

The actual log rotating programme used, my vary from distribution to distribution. On debian (and possibly on other linuxes as well) both naming scheme and retention period are defined in /etc/logrotate.conf and /etc/logrotate.d/apache2

Fiddling with those files should solve your problems.

share|improve this answer

$ man logrotate

And look around the corner of your /etc/logrotate.d directory.

share|improve this answer

Please be aware that depends where you are and where you work, rotating (deleting) logs are a serious offense. For PCI/HIPAA compliance (and others) you need to store the logs for at least 6 months/1 year.

My recommendation is to disable rotation completely (generally by removing the files from /etc/logrotate.d ) and forward them to central location...

*I really hate the default behavior on linux systems to treat logs as not very important.

share|improve this answer

By default your system will use logrotate, which will rename logs. That can be a good policy for some system logs, but I don't think it's the best option for www logs. One good option for Apache is to use a different logger: cronolog will rotate your logs changing its name and can be configured to do nearly everything you coud do.

There are a lot of articles about how to use and configure cronolog, there are many that will instruct you to modify your Apache configuration file (usually in /etc/httpd/) to get nicer weblogs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.