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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
htaccess restrict subdomain 4 112
Alias for "domain to path" translation instead of VirtualHost on Apache 3 72
Virtual host in apache 31 90
whm high memory usage in processes 7 88
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…
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 …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 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