Why rotated files has not the timestamp of the last logrotate run
Issue
- With a cron job that rotates file regularly, the timestamp of rotated files does not correspond to the date of the rotation:
[root@rhel76 test]# ll
total 4.0K
-rw-------. 1 root root 5 Sep 28 10:20 test.log
[root@rhel76 test]# date
Mon Sep 28 10:43:06 EDT 2020
[root@rhel76 test]# logrotate -v /etc/logrotate.d/test
reading config file /etc/logrotate.d/test
Allocating hash table for state file, size 15360 B
Handling 1 logs
rotating pattern: /var/log/test/*log 5 bytes (90 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/test/test.log
log needs rotating
running first action script
rotating log /var/log/test/test.log, log->rotateCount is 90
dateext suffix '-20200928'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
fscreate context set to unconfined_u:object_r:var_log_t:s0
renaming /var/log/test/test.log to /var/log/test/test.log-20200928
running postrotate script
compressing log with: /bin/gzip
set default create context to unconfined_u:object_r:var_log_t:s0
set default create context
[root@rhel76 test]# ll
total 4.0K
-rw-------. 1 root root 25 Sep 28 10:20 test.log-20200928.gz
- => The compressed file timestamp has not been updated: still 25 Sep 28 10:20
Environment
- Red Hat Enterprise Linux
- logrotate
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.