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

    Help With Logrotate

    Hi there, I was hoping someone could help me with logrotate not behaving as I would expect it to. Probably a simple one:

    So I have a big apache log that I want to rotate when it reaches 20Meg:

    -rw-r--r-- 1 apache apache 134M May 9 08:58 access_log
    -rw-r--r-- 1 apache apache 3.1M May 9 05:49 error_log

    My config is like so:

    /var/www/vhosts/mydomain/statistics/logs/*log {
    size 20M
    create 640 apache apache
    rotate 6
    if [ -f /var/run/ ]; then
    /etc/init.d/httpd restart > /dev/null

    I would expect to see 6 logfiles of 20Meg each, but it just dumps everything to access_log.1. Whats wrong here?

    -rw-r--r-- 1 apache apache 0 May 9 09:08 access_log
    -rw-r--r-- 1 apache apache 134M May 9 09:07 access_log.1
    -rw-r--r-- 1 apache apache 3.1M May 9 05:49 error_log

    Many thanks


  2. #2

    You have 1 log. The rule can't do anything about your logs *in the past.* The final size will depend on how much it compresses - which you have set to delaycompress, so that won't happen until the first log is rotated to the 2ND log.

    It's all in the manual.

Posting Permissions

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