apache, linux, logrotate & naming of rotated logfiles

Posted on 2002-05-07
Last Modified: 2008-02-26

I want to have logrotate name my rotated apache logs with today's date (e.g., access_log.05062002.gz instead of access_log.1.gz).

I am sure some combination of things in /etc/logrotate.d/apache will do the trick, either pre-rotation or post-rotation, etc.  Can anyone help?



Question by:rdefuria
  • 3
  • 2
LVL 15

Accepted Solution

samri earned 50 total points
ID: 6995582
I think the post-rotation would be the options.

What you need to do is to rename the logfile from access_log.1.gz to access_log.ddmmyyyy.gz


Expert Comment

ID: 6999940
I am using cronolog and it works really good.
LVL 15

Expert Comment

ID: 7000361

prokni is correct, cronolog would do it very nicely

However you would need to get cronolog installled and configure.  I tried on Win2K (struggling for hours already - haven't got it to work).

Other options that could be used:

Anyhow, these would requires the apache-service to be restarted (from cron maybe) for the log rotation to work.

I would personally go for logrotate, and write add the renaming part in post-rotate section. (since this is my proposition).  Cronolog is good too.

Expert Comment

ID: 7000553
I installed it on sun Solaris 2.8 very easily.
LVL 15

Expert Comment

ID: 7000585
I guess any other OS but Windoze should be pretty straight forward :(

Btw, what happened to Tia. ?

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

757 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

20 Experts available now in Live!

Get 1:1 Help Now