Solved

How to create new log files everyday...

Posted on 2004-08-25
10
324 Views
Last Modified: 2010-03-04
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
Comment
Question by:andreni78
10 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 11899967
The logfile- rotation is typical done by external scripts like logrotate. Which OS are you using ??
0
 

Author Comment

by:andreni78
ID: 11900167
Win2k3
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 11900224
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
 

Author Comment

by:andreni78
ID: 11900417
that directive should work fine with apache 1.3 and 2 right? just add it anywhere in the httpd.conf?
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 11900457
Yes it is included into both Apache1.3 and 2.0
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:andreni78
ID: 11900579
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
 

Author Comment

by:andreni78
ID: 11900581
i tried both transferlog and customlog
0
 
LVL 19

Accepted Solution

by:
ramazanyich earned 250 total points
ID: 11900673
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
 
LVL 6

Expert Comment

by:prof666
ID: 11907635
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
 

Author Comment

by:andreni78
ID: 11907860
BEAUTIFUL.. RAMAZANYICH.. it works!! Thanks!!!!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now