Logrotate не работает

Добрый день!
Сегодня заметил, что logrotate выдает ошибку при попытке сжатия /var/log/messages. (Другие сервисы не проверял)
Мне помогла эта инструкция.
Пожалуйста, поправьте в следующем релизе, так как памяти в контроллере довольно мало.

1 лайк

Добрый день!

Спасибо.
Ещё напишите, пожалуйста, на всякий случай, какой у вас контроллер, и какая версия logrotate.

logrotate 3.11.0
Контроллер WB6

Утомляет немного похожая проблема, когда из-за этой ошибки на почту каждое утра валятся письма от каждого контроллера с ошибкой

Текст почтового уведомления

/etc/cron.daily/logrotate:
error: Compressing program wrote following message to stderr when compressing log /var/log/mosquitto/mosquitto.log.1:
gzip: stdin: file size changed while zipping

–verbose дало расширенное сообщение

расширенное уведомление

/etc/cron.daily/logrotate:
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apt
reading config file dpkg
reading config file messages
reading config file mosquitto
reading config file nginx
reading config file ppp
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state

Handling 10 logs

rotating pattern: /var/log/apt/term.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apt/term.log
Now: 2019-12-02 06:25
Last rotated at 2019-04-05 06:25
log does not need rotating (log is empty)

rotating pattern: /var/log/apt/history.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apt/history.log
Now: 2019-12-02 06:25
Last rotated at 2019-04-05 06:25
log does not need rotating (log is empty)

rotating pattern: /var/log/dpkg.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/dpkg.log
Now: 2019-12-02 06:25
Last rotated at 2019-04-05 06:25
log does not need rotating (log is empty)

rotating pattern: /var/log/alternatives.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/alternatives.log
log /var/log/alternatives.log does not exist – skipping

rotating pattern: /var/log/messages 204800 bytes (2 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/messages
Now: 2019-12-02 06:25
Last rotated at 2019-12-01 06:25
log needs rotating
rotating log /var/log/messages, log->rotateCount is 2
dateext suffix ‘-20191202’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/messages.2.gz to /var/log/messages.3.gz (rotatecount 2, logstart 1, i 2),
renaming /var/log/messages.1.gz to /var/log/messages.2.gz (rotatecount 2, logstart 1, i 1),
renaming /var/log/messages.0.gz to /var/log/messages.1.gz (rotatecount 2, logstart 1, i 0),
old log /var/log/messages.0.gz does not exist
renaming /var/log/messages to /var/log/messages.1
creating new /var/log/messages mode = 0644 uid = 0 gid = 0
compressing log with: /bin/gzip
removing old log /var/log/messages.3.gz

rotating pattern: /var/log/mosquitto/mosquitto.log 102400 bytes (7 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/mosquitto/mosquitto.log
Now: 2019-12-02 06:25
Last rotated at 2019-12-01 06:25
log needs rotating
rotating log /var/log/mosquitto/mosquitto.log, log->rotateCount is 7
dateext suffix ‘-20191202’
glob pattern ‘-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’
renaming /var/log/mosquitto/mosquitto.log.7.gz to /var/log/mosquitto/mosquitto.log.8.gz (rotatecount 7, logstart 1, i 7),
renaming /var/log/mosquitto/mosquitto.log.6.gz to /var/log/mosquitto/mosquitto.log.7.gz (rotatecount 7, logstart 1, i 6),
renaming /var/log/mosquitto/mosquitto.log.5.gz to /var/log/mosquitto/mosquitto.log.6.gz (rotatecount 7, logstart 1, i 5),
renaming /var/log/mosquitto/mosquitto.log.4.gz to /var/log/mosquitto/mosquitto.log.5.gz (rotatecount 7, logstart 1, i 4),
renaming /var/log/mosquitto/mosquitto.log.3.gz to /var/log/mosquitto/mosquitto.log.4.gz (rotatecount 7, logstart 1, i 3),
renaming /var/log/mosquitto/mosquitto.log.2.gz to /var/log/mosquitto/mosquitto.log.3.gz (rotatecount 7, logstart 1, i 2),
renaming /var/log/mosquitto/mosquitto.log.1.gz to /var/log/mosquitto/mosquitto.log.2.gz (rotatecount 7, logstart 1, i 1),
renaming /var/log/mosquitto/mosquitto.log.0.gz to /var/log/mosquitto/mosquitto.log.1.gz (rotatecount 7, logstart 1, i 0),
old log /var/log/mosquitto/mosquitto.log.0.gz does not exist
renaming /var/log/mosquitto/mosquitto.log to /var/log/mosquitto/mosquitto.log.1
running postrotate script
compressing log with: /bin/gzip
error: Compressing program wrote following message to stderr when compressing log /var/log/mosquitto/mosquitto.log.1:
gzip: stdin: file size changed while zipping
removing old log /var/log/mosquitto/mosquitto.log.8.gz

rotating pattern: /var/log/nginx/*.log weekly (52 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/nginx/access.log
Now: 2019-12-02 06:25
Last rotated at 2019-11-10 06:25
log does not need rotating (log is empty)
considering log /var/log/nginx/error.log
Now: 2019-12-02 06:25
Last rotated at 2019-11-30 06:25
log does not need rotating (log is empty)
not running prerotate script, since no logs will be rotated
not running postrotate script, since no logs were rotated

rotating pattern: /var/log/ppp-connect-errors weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/ppp-connect-errors
Now: 2019-12-02 06:25
Last rotated at 2019-03-31 06:26
log does not need rotating (log is empty)

rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/wtmp
Now: 2019-12-02 06:25
Last rotated at 2019-12-01 06:25
log does not need rotating (log has been rotated at 2019-12-1 6:25, that is not month ago yet)

rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
Now: 2019-12-02 06:25
Last rotated at 2019-12-01 06:25
log does not need rotating (log has been rotated at 2019-12-1 6:25, that is not month ago yet)

У вас такое присутствует?