andreni78
asked on
How to create new log files everyday...
I'm running apache - and my log files are growing huge.. what's the exact command i need to do to start a new log file everyday? I'd like a 2 month rotation schedule... any help is much appreciated thanks!
The logfile- rotation is typical done by external scripts like logrotate. Which OS are you using ??
ASKER
Win2k3
Apache has special program rotatelogs in $apache_root/bin directory.
Usage: ./rotatelogs <logfile> <rotation time in seconds> [offset minutes from UTC] or <rotation size in megabytes>
Add this:
TransferLog "|./rotatelogs /some/where 86400"
or
TransferLog "|./rotatelogs /some/where 5M"
to httpd.conf. The generated name will be /some/where.nnnn where nnnn is the
system time at which the log nominally starts (N.B. if using a rotation time,
the time will always be a multiple of the rotation time, so you can synchronize
cron scripts with it). At the end of each rotation time or when the file size
is reached a new log is started.
Usage: ./rotatelogs <logfile> <rotation time in seconds> [offset minutes from UTC] or <rotation size in megabytes>
Add this:
TransferLog "|./rotatelogs /some/where 86400"
or
TransferLog "|./rotatelogs /some/where 5M"
to httpd.conf. The generated name will be /some/where.nnnn where nnnn is the
system time at which the log nominally starts (N.B. if using a rotation time,
the time will always be a multiple of the rotation time, so you can synchronize
cron scripts with it). At the end of each rotation time or when the file size
is reached a new log is started.
ASKER
that directive should work fine with apache 1.3 and 2 right? just add it anywhere in the httpd.conf?
Yes it is included into both Apache1.3 and 2.0
ASKER
i tried that directive... doesn't seem to work.. i tried renaming the log file to different files to see if it creates new files.. it doesn't... hmmm
ASKER
i tried both transferlog and customlog
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hemst42,
Take a look at cronolog
http://cronolog.org/
As this can be set to rotate apache logs on a daily basis.
Da Prof
Take a look at cronolog
http://cronolog.org/
As this can be set to rotate apache logs on a daily basis.
Da Prof
ASKER
BEAUTIFUL.. RAMAZANYICH.. it works!! Thanks!!!!