Logrotate: log does not require rotation

logrotate does not rotate my logs

To verify that the log file is not empty:

# ls -laFh /var/log/cisco-meraki.log
-rw-r----- 1 root adm 2.8G Sep  5 13:23 /var/log/cisco-meraki.log

Configuration (/etc/logrotate.d/zzzzz_default):

"/var/log/cisco-meraki.log" {
    daily
    rotate 10
    compress
    missingok
    notifempty
    create
}

Global configuration (logrotate.conf):

daily
rotate 10
create
include /etc/logrotate.d
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}
/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

Manual start attempt:

# logrotate --verbose -d zzzzz_default
reading config file zzzzz_default

Handling 1 logs

rotating pattern: "/var/log/cisco-meraki.log"  after 1 days (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/cisco-meraki.log
  log does not need rotating

To make sure that the problem is not "everything is already rotated," I checked:

# cat /var/lib/logrotate/status|grep cisco
"/var/log/cisco-ace.log" 2016-1-19-16:0:0
"/var/log/cisco-pix.log" 2016-1-19-16:0:0
"/var/log/cisco-acs.log" 2016-1-19-16:0:0
"/var/log/cisco-asa.log" 2016-1-19-16:0:0
"/var/log/cisco-router.log" 2016-9-6-0:1:1
"/var/log/cisco-ips.log" 2016-1-19-16:0:0

.. but not cisco-meraki.log

+4
source share
2 answers

On the man logrotate page:

      -d, --debug
           Turns on debug mode and implies -v.  In debug mode, no
           changes will be made to the logs or to the logrotate
           state file.

The exact same problem struck me!

N.

+1
source

see https://unix.stackexchange.com/a/96947

Suppose you created the zzzzz_default file today. logrotate will create a record, as if it rotated the logs today in / var / lib / logrotate / status.

logrotate --verbose -d zzzzz_default logrotate , , /var/lib/logrotate/status. , , , log does not need rotating

logrotate --verbose -d zzzzz_default logrotate , , /var/lib/logrotate/status. , .

+1

Source: https://habr.com/ru/post/1660768/


All Articles