Solved

Logrotate

Posted on 2004-09-27
5
310 Views
Last Modified: 2013-12-25
Hi,

I want to have logrotate name my rotated apache logs with today's date (e.g., access_log.092804.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?

Thanks!

-Mike
0
Comment
Question by:mj9821
5 Comments
 
LVL 2

Author Comment

by:mj9821
ID: 12166698
Here is my current logrotate settings:

/var/log/httpd/access_log {
    daily
    missingok
    rotate 31
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
    compress
}
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 12172823
What you are searching is

      dateext
              Archive  old  versions of log files adding a daily extension like YYYYMMDD instead of
              simply adding a number.

option of logrotate
man logrotate

/var/log/httpd/access_log {
    daily
    dateext
    missingok
    rotate 31
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
    compress
}
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to dynamically set the form action using jQuery.

770 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