0

This is my setting logrotate

 /home/sy/logs/kitxit*/*/tend.log
    {
        daily
        rotate 10
        dateext
        compress
        delaycompress
        copytruncate
        missingok
        notifempty
        su apache apache
    }

Output is like below

drwxr-xr-x 2 apache apache     4096 Apr 30 13:00 .
drwxr-xr-x 6 apache apache     4096 Apr 30 13:00 ..
-rw-r--r-- 1 apache apache 21318609 May  2 21:25 tend.log
-rw-r--r-- 1 apache apache     4091 Feb 24 03:02 tend.log-20200224.gz
-rw-r--r-- 1 apache apache     4065 Feb 25 03:02 tend.log-20200225.gz
-rw-r--r-- 1 apache apache     4460 Feb 26 03:03 tend.log-20200226.gz
-rw-r--r-- 1 apache apache     4049 Feb 27 03:03 tend.log-20200227.gz
-rw-r--r-- 1 apache apache     2619 Feb 28 03:03 tend.log-20200228.gz
-rw-r--r-- 1 apache apache     1312 Feb 29 03:03 tend.log-20200229.gz
-rw-r--r-- 1 apache apache     1339 Mar  1 03:03 tend.log-20200301.gz
-rw-r--r-- 1 apache apache     1305 Mar  2 03:03 tend.log-20200302.gz
-rw-r--r-- 1 apache apache     2669 Mar  3 03:02 tend.log-20200303.gz
-rw-r--r-- 1 apache apache    70011 Mar  4 03:03 tend.log-20200304

Why am I still seeing old log files and not having new ones?

This is a result of debug mode

 [root@xavs-ken logrotate.d]# logrotate -dv kitxit-tend-sylog
reading config file kitxit-tend-sylog
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /home/sy/logs/kitxit*/*/tend/*.log
/home/sy/logs/kitxit*/*/sylog/*.log
 after 1 days (10 rotations)
empty log files are not rotated, old logs are removed
switching euid to 48 and egid to 48
considering log /home/sy/logs/kitxit2/bola/tend/sql.log
  log needs rotating
considering log /home/sy/logs/kitxit2/bola/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/bola/tend/mem.log
  log does not need rotating (log is empty)considering log /home/sy/logs/kitxit/bola/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/clpl/tend/sql.log
  log needs rotating
considering log /home/sy/logs/kitxit/clpl/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/mol/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/pola/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/solsa/tend/sql.log
  log needs rotating
considering log /home/sy/logs/kitxit/solsa/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/sario/tend/mem.log
  log does not need rotating (log is empty)considering log /home/sy/logs/kitxit/sario/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/sasu/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/kilo/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/mixi/tend/mem.log
  log does not need rotating (log is empty)considering log /home/sy/logs/kitxit/mixi/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/aziz/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit/xondana/tend/tend.log
  log needs rotating
considering log /home/sy/logs/kitxit2/bola/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/bola/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/clpl/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/mol/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/pola/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/solsa/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/entag/sylog/action.log
  log does not need rotating (log is empty)considering log /home/sy/logs/kitxit/sario/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/sasu/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/kilo/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/mixi/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/aziz/sylog/action.log
  log needs rotating
considering log /home/sy/logs/kitxit/xondana/sylog/action.log
  log needs rotating
rotating log /home/sy/logs/kitxit2/bola/tend/sql.log, log->rotateCount is 10
dateext suffix '-20200503'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding logs to compress failed
copying /home/sy/logs/kitxit2/bola/tend/sql.log to /home/sy/logs/kitxit2/bola/tend/sql.log-20200503
truncating /home/sy/logs/kitxit2/bola/tend/sql.log
rotating log /home/sy/logs/kitxit2/bola/tend/tend.log, log->rotateCount is 10
dateext suffix '-20200503'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding logs to compress failed
glob finding old rotated logs failed

...

  • man logrotate offers a debug option, which "means that no changes are made to the logs and [...] debug messages are printed". Have you tried it? – roaima May 2 at 17:57
  • @roaima, thanks for reply. I have edited result of debug mode, it seems that it not rotating properly. – janobX May 3 at 11:14
  • You may have to make the application reopen the log file upon rotation (often done by sending a HUP signal to the process). If it hasn't opened the log in append mode, it would otherwise just write to the same point in the file. Is the tend.log file filled with null bytes in the beginning of the file? – Kusalananda May 3 at 11:14
  • Possible duplicate: unix.stackexchange.com/questions/579528/… – Kusalananda May 3 at 11:16
  • @Kusalananda I don't think so - if you look at the dates of the older rotated files you'll see that rotation has just stopped – roaima May 5 at 13:30
1

The log files in the debug output do not correspond to the logrotate path in the configuration file.

Files matching tend.log in the debug output

considering log /home/sy/logs/kitxit2/bola/tend/tend.log
considering log /home/sy/logs/kitxit/clpl/tend/tend.log
considering log /home/sy/logs/kitxit/mol/tend/tend.log
considering log /home/sy/logs/kitxit/pola/tend/tend.log
considering log /home/sy/logs/kitxit/solsa/tend/tend.log
considering log /home/sy/logs/kitxit/sasu/tend/tend.log
considering log /home/sy/logs/kitxit/kilo/tend/tend.log
considering log /home/sy/logs/kitxit/aziz/tend/tend.log
considering log /home/sy/logs/kitxit/xondana/tend/tend.log

Logrotate configuration

/home/sy/logs/kitxit*/*/tend.log

This pattern would need to be amended as follows to match the files being considered, i.e. with another */ in the path

/home/sy/logs/kitxit*/*/*/tend.log

Since your target files are being referenced in the debug output I would surmise that there is another logrotate snippet somewhere that stopped working around March 4th/5th.

| improve this answer | |
  • thank you, I`ll give a try – janobX May 3 at 15:15
  • @janobX I'm curious, what was actually wrong? – roaima May 6 at 10:47

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.