Link to home
Start Free TrialLog in
Avatar of andreni78
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!
Avatar of hernst42
hernst42
Flag of Germany image

The logfile- rotation is typical done by external scripts like logrotate. Which OS are you using ??
Avatar of andreni78
andreni78

ASKER

Win2k3
Avatar of ramazanyich
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.
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
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
i tried both transferlog and customlog
ASKER CERTIFIED SOLUTION
Avatar of ramazanyich
ramazanyich
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hemst42,

Take a look at cronolog

http://cronolog.org/

As this can be set to rotate apache logs on a daily basis.

Da Prof
BEAUTIFUL.. RAMAZANYICH.. it works!! Thanks!!!!