I've a log of a busy website that grows very fast. I'd like to know if there's a way to "split" the log file every day without using external tools.
EDIT: My Fault, I'm on a Windows server 2003, Apache Version 2.0.64.
I've a log of a busy website that grows very fast. I'd like to know if there's a way to "split" the log file every day without using external tools.
EDIT: My Fault, I'm on a Windows server 2003, Apache Version 2.0.64.
You can use logrotate to keep your log files small and you can also compress them.
For example, you can use something like:
This will keep five rotated files. The logs will be rotated daily and compressed. For more info, see
man logrotate
.Apache httpd is capable of writing error and access log files through a pipe to another process, rather than directly to a file. This capability dramatically increases the flexibility of logging, without adding code to the main server. In order to write logs to a pipe, simply replace the filename with the pipe character "|", followed by the name of the executable which should accept log entries on its standard input.
You can use this technique to pipe the logs to a script which then splits the logs in any way you like. This is often used to split by virtual host.