Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Logrotate

Posted on 2004-09-27
5
Medium Priority
?
316 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
[X]
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
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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

670 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