[Never acknowledged] - logrotate does not honor size?

General support questions
Post Reply
User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

[Never acknowledged] - logrotate does not honor size?

Post by warron.french » 2021/05/05 12:55:26

I have the following scenario,
I have an entry in /etc/rsyslog.conf to forward kern.info to /var/log/martian_test:

Code: Select all

kern.info                   /var/log/martian_test
I have a logrotate policy to roll the file /var/log/martian_test, that I want to roll the file at midnight or when the size exceeds 8k. I know how to make the log roll at midnight specifically; however, this file will not roll once it has exceeded 8k in size.
I presently have the following in place (using logrotate -f /etc/logrotate.d/martian, no "_test"):

Code: Select all

/var/log/martian_test {
size 8k
hourly
missingok
notifempty
rotate 4
dateext
dateyesterday
delaycompress
compress
compresscmd  /bin/xz
compressoptions  -9
compressext  .xz
copytruncate
sharedscripts
postrotate
    /bin/systemctl stop  rsyslog &&  sleep 2; /bin/systemctl start rsyslog
endscript
}
This does not work to rotate /var/log/martian_test when it reaches or exceeds a size of 8k. If I change the `size` term to `maxsize` it also does not work.

I found this article, https://serverfault.com/questions/39153 ... y-and-size, albeit almost 9 years old, but the manpage conflicts with this detail.

Please NOTE: I have also altered the order of the "*size" and time-associated (hourly) directives and that too has had no effect.
Thanks,
War

Post Reply