• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

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!
0
andreni78
Asked:
andreni78
1 Solution
 
hernst42Commented:
The logfile- rotation is typical done by external scripts like logrotate. Which OS are you using ??
0
 
andreni78Author Commented:
Win2k3
0
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
ramazanyichCommented:
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
 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now