0

What's wrong with my config? I had to --force the logrotate a couple times to see changes, but the numbering is all wonky.

    ----@----------:/var/log/upstart# ls -Anh
    total 4.0G
    -rw-r----- 1 0 0  56K Aug 21 08:41 graylog-server.log
    -rw-r----- 1 0 0 1.1G Aug 21 08:36 graylog-server.log.1.1.gz
    -rw-r----- 1 0 0 727M Aug 21 08:35 graylog-server.log.1.gz.1.gz
    -rw-r----- 1 0 0    0 Aug 20 11:22 graylog-server.log.2.gz
    -rw-r----- 1 0 0  28K Aug 20 10:40 graylog-server.log.3.gz.1.gz
    -rw-r----- 1 0 0 1.2G Aug 20 10:29 graylog-server.log.4.gz.1
    -rw-r----- 1 0 0 861M Aug 21 08:40 graylog-server.log.4.gz.1.gz
    -rw-r----- 1 0 0 212M Aug 20 10:25 graylog-server.log.5.gz
    -rw-r----- 1 0 0 5.3M Aug 20 06:25 graylog-server.log.6.gz

Config:

----@----------:/var/log/upstart# vim /etc/logrotate.d/upstart

/var/log/upstart/*-server.log.* {
        size 3G
        missingok
        rotate 5
        compress
        notifempty
        nocreate
}

Using logrotate

--force /etc/logrotate.d/upstart

to rotate.

1

It seems that you are log-rotating already log-rotated logs.

In your config you use /var/log/upstart/*-server.log.* to select the files to rotate. This expression matches graylog-server.log.1 but no graylog-server.log. So you are rotating the old rotated log files but not the current log file.

Probably you want to use /var/log/upstart/*-server.log instead.

  • Ok, I'll give that a try. I also wanted to ask how often the system checks for the size condition...like if it has to sit at 3GB for a couple hours before it'll rotate or if it happens instantly? edit: that does fix the file extension issue. – KuboMD Aug 21 '18 at 13:56
  • @KuboMD ask this in another question. – andcoz Aug 21 '18 at 14:07
  • I tried making that change to the conf and running the logrotate force again. It works the first time around, but the second time around it adds a ".1" to the end of my plaintext, uncompressed log - which means it is no longer caught by "*-server.log". Any suggestions? – KuboMD Aug 21 '18 at 15:15
  • Fascinating. Did you cleaned the dir of old wrong files before you tried again? – andcoz Aug 21 '18 at 16:06
  • There is no reason (in your config file) for that .1. Please, check if there is any other rule in logrotate config files matching that log file. – andcoz Aug 21 '18 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.