How to create new log files everyday...

Posted on 2004-08-25
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!
Question by:andreni78
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Expert Comment

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

Author Comment

ID: 11900167
LVL 19

Expert Comment

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"


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.
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.


Author Comment

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

Expert Comment

ID: 11900457
Yes it is included into both Apache1.3 and 2.0

Author Comment

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

Author Comment

ID: 11900581
i tried both transferlog and customlog
LVL 19

Accepted Solution

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

Expert Comment

ID: 11907635

Take a look at cronolog

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

Da Prof

Author Comment

ID: 11907860
BEAUTIFUL.. RAMAZANYICH.. it works!! Thanks!!!!

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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