I'm trying to compress the messages cause its growing huge in size and there is not much space. I tried all from - compress-messages - to compress the messages but its with

glob finding old rotated logs failed

My logrotate is similar to the one in the link

# cat logrotate-message; logrotate -d logrotate-message -f;ls -lrth /var/log/messages*
rotate 7
dateformat .%Y%m%d
/var/log/messages {
    rotate 5
        /bin/killall -HUP syslogd
reading config file logrotate-message
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /var/log/messages  forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/messages
  log needs rotating
rotating log /var/log/messages, log->rotateCount is 5
Converted ' .%Y%m%d' -> '.%Y%m%d'
dateext suffix '.20191024'
glob pattern '.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
renaming /var/log/messages to /var/log/messages.20191024
creating new /var/log/messages mode = 0600 uid = 0 gid = 0
running postrotate script
running script with arg /var/log/messages: "
        /bin/killall -HUP syslogd
compressing log with: /bin/gzip
-rw------- 1 root root 1016K Sep 29 03:13 /var/log/messages-20190929
-rw------- 1 root root 1020K Oct  6 03:34 /var/log/messages-20191006
-rw------- 1 root root  2.2G Oct 23 11:31 /var/log/messages.20191023
-rw------- 1 root root  735M Oct 24 15:41 /var/log/messages 

Any help will be appreciated.

  • What does file /var/log/messages.20191023 return?
    – Kusalananda
    Oct 24, 2019 at 21:19
  • Like below # file /var/log/messages.20191023 /var/log/messages.20191023: ASCII text, with very long lines
    – Senthil13
    Oct 24, 2019 at 21:23
  • Ok, I thought for a while that it compressed it but didn't give it the .gz suffix.
    – Kusalananda
    Oct 24, 2019 at 21:29
  • Its not compressing, in the debug output its erroring like glob finding old rotated logs failed
    – Senthil13
    Oct 24, 2019 at 21:45

1 Answer 1


Ok, your logrotate is failing because of missing log files. When you use logrotate -d you are getting verbose debug output but logrotate does not do anything. If you first do

logrotate -v logrotate-message -f

instead the force option, combined with verbose output will show you the operation of -f flag, which per man logrotate will create missing log files to prevent errors related to previous log files not being found.

You are not finding the 4 log archives because in the first two filenames you have a - where a . should be and the pattern regex fails because of it. Try correcting by hand or logrotate -f create it after deleting these first.

Also, your formatting of the specifc messages configuration file is a little cumbersome. There is no reason to have configuration options above the brackets enclosing the individual script for messages (as that can overwrite global config options depending on how they are read ) and you should move the compress and other flags into it.

  • There are some errors which i can check by my own, but you suggestion working perfectly.
    – Senthil13
    Oct 25, 2019 at 12:49

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.