Find the answer to your Linux question:
Results 1 to 2 of 2
Hi there I work with redhat linux and I use apache 1.3.x needed for my application. Now, I'd like to logrotate the log files form apache included with a date-stamp ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2004
    Posts
    19

    logrotate with date-stamp


    Hi there

    I work with redhat linux and I use apache 1.3.x needed for my application.

    Now, I'd like to logrotate the log files form apache included with a date-stamp in the file name.

    Does somebody know how to do it????

    Example: access_Log.20040706

    thanks for help

    bigbrother

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Well, one simple way to do that would be to add this very simple shell script to your /etc/cron.daily:
    Code:
    #!/bin/sh
    PATH=$PATH:/usr/local/sbin:/sbin:/usr/sbin
    cd /var/log/httpd
    mv access_log access_log.$(date +'%Y%m%d')
    apachectl restart
    It's necessary to make it restart apache at the end to create a new log file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •