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!
andreni78Asked:
Who is Participating?
 
ramazanyichConnect With a Mentor Commented:
Could you send your directoves which you tried ?
As you are working on Windows I I suggest to use full pathnames. Eg.,
CustomLog "|c:/apache/bin/rotatelogs c:/apache/logs/access.localhost.log 100" combined
0
 
hernst42Commented:
The logfile- rotation is typical done by external scripts like logrotate. Which OS are you using ??
0
 
andreni78Author Commented:
Win2k3
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
ramazanyichCommented:
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.
0
 
andreni78Author Commented:
that directive should work fine with apache 1.3 and 2 right? just add it anywhere in the httpd.conf?
0
 
ramazanyichCommented:
Yes it is included into both Apache1.3 and 2.0
0
 
andreni78Author Commented:
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
0
 
andreni78Author Commented:
i tried both transferlog and customlog
0
 
prof666Commented:
Hemst42,

Take a look at cronolog

http://cronolog.org/

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

Da Prof
0
 
andreni78Author Commented:
BEAUTIFUL.. RAMAZANYICH.. it works!! Thanks!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.