tags:

views:

3452

answers:

6

I've got an Apache server that has one access log file that is topping 600MB. This makes it really hard to search the file or parse it.
What software or modules for Apache are available that will make a daily copy of my access file to make it more manageable?

+15  A: 

Have you looked at logrotate - this is probably the simplest, most widely available and well undestood method of achieving this. It is highly configurable and will probably do 90% of what you need.

serg10
typo: "undestood" -> "understood"
Bobby Jack
+1  A: 

logrotate is probably the best solution. Use the file '/etc/logrotate.conf' to change the settings for all your logs. You van change 'weekly' to 'daily' so the logs are rotated every day. Also, you might want to add 'compress' so the archives are compressed. If you don't care about the old logs, you can set rotate 'rotate 4' to something lower.

Eric Hogue
I'm intrigued - what are the differences between this and the apache-supplied 'rotatelogs'? And why doesn't the apache manual mention logrotate (yet it does refer to cronolog)?
Bobby Jack
Just an assumption: this could be because logrotate is not available on all system Apache is running. I have only used it on Linux installations, where it is used to rollover all of the system logs, and of course Apache's log files.
Kariem
+5  A: 

I'm a big fan of Cronolog. Just install and pipe your logs through it. For daily log rotation, something like this would work:

ErrorLog  "|/usr/bin/cronolog /path/to/logs/%Y-%m-%d/error.log"
CustomLog "|/usr/bin/cronolog /path/to/logs/%Y-%m-%d/access.log" combined

Pretty handy, and once installed, easier (in my experience) than logrotate.

Brian
+1  A: 

The actual command for Windows, which is quite difficult to find online is:

CustomLog '|" "*Apache-Path/bin/rotatelogs.exe" "*Apache-Path/logs/backup/internet_access_%d-%m-%y.log" 86400' combined

Where the "internet_access" bit is the name you choose for your files, the 86400 is the number of seconds in one day. You need to change the Apache-Path to the relevant directory you've installed Apache to.

alimack
+1  A: 

1) apache rotatelogs

2) apache module mod_log_rotate

3) logrotate

I don't know the differences. Maybe someone can explain it?

Andrew

Andrew
A: 

Hi Andrew rotatelog.exe or cronolog.exe on windows os. They are used in pipe command in http.conf Mod_log_rotate additional module for apache ONLY for access log rotation Logrotate ONLY for unix os

I hope it's help @+ Fabien

fabien