Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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


  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    Well, one simple way to do that would be to add this very simple shell script to your /etc/cron.daily:
    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