Я установил новую конфигурацию для logrotate, но никак не мог заставить ее работать.
Вот мой логротейт:
/home/deployer/abc/shared/log/*.log {
daily
missingok
rotate 30
compress
delaycompress
size 5M
copytruncate
}
Вот что я пробовал:
Удален файл статуса:
deployer@qapp01:~/abc/current/log$ cat /var/lib/logrotate/status
logrotate state -- version 2
Выполнить logrotate в режиме отладки
deployer@qapp01:~/abc/current/log$ /usr/sbin/logrotate -d /etc/logrotate.conf
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apt
reading config file aptitude
reading config file dpkg
reading config file fail2ban
reading config file monit
reading config file mysql-server
reading config file newrelic-sysmond
reading config file nginx
reading config file ppp
reading config file abc
reading config file rsyslog
reading config file ufw
reading config file unattended-upgrades
reading config file upstart
Handling 19 logs
rotating pattern: /var/log/apt/term.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/apt/history.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/aptitude monthly (6 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/dpkg.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/alternatives.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/fail2ban.log weekly (4 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/monit.log weekly (4 rotations)
empty log files are not rotated, only log files >= 1048576 bytes are rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log after 1 days (7 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/newrelic/nrsysmond.log after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/nginx/*.log after 1 days (14 rotations)
empty log files are not rotated, old logs are removed
No logs found. Rotation not needed.
rotating pattern: /var/log/ppp-connect-errors weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /home/deployer/abc/shared/log/*.log 5242880 bytes (30 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/syslog
after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/ufw.log
weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/unattended-upgrades/unattended-upgrades.log
/var/log/unattended-upgrades/unattended-upgrades-shutdown.log
monthly (6 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/upstart/*.log after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
error: error switching euid to 0 and egid to 104: Operation not permitted
Пробовал запустить его с помощью sudo
deployer@qapp01:~/abc/current/log$ sudo /usr/sbin/logrotate -d /etc/logrotate.conf
[sudo] password for deployer:
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apt
reading config file aptitude
reading config file dpkg
reading config file fail2ban
reading config file monit
reading config file mysql-server
reading config file newrelic-sysmond
reading config file nginx
reading config file ppp
reading config file abc
reading config file rsyslog
reading config file ufw
reading config file unattended-upgrades
reading config file upstart
Handling 19 logs
rotating pattern: /var/log/apt/term.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/apt/term.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/apt/history.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/apt/history.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/aptitude monthly (6 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/aptitude
log /var/log/aptitude does not exist -- skipping
switching euid to 0 and egid to 0
rotating pattern: /var/log/dpkg.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/dpkg.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/alternatives.log monthly (12 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/alternatives.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/fail2ban.log weekly (4 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/fail2ban.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/monit.log weekly (4 rotations)
empty log files are not rotated, only log files >= 1048576 bytes are rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/monit.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log after 1 days (7 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/mysql.log
log does not need rotating
considering log /var/log/mysql/mysql.log
log does not need rotating
considering log /var/log/mysql/mariadb-slow.log
log /var/log/mysql/mariadb-slow.log does not exist -- skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/newrelic/nrsysmond.log after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/newrelic/nrsysmond.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/nginx/*.log after 1 days (14 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/nginx/access.log
log does not need rotating
considering log /var/log/nginx/error.log
log does not need rotating
not running prerotate script, since no logs will be rotated
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/ppp-connect-errors weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/ppp-connect-errors
log /var/log/ppp-connect-errors does not exist -- skipping
switching euid to 0 and egid to 0
rotating pattern: /home/deployer/abc/shared/log/*.log 5242880 bytes (30 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /home/deployer/abc/shared/log/newrelic_agent.log
log does not need rotating
considering log /home/deployer/abc/shared/log/nginx.access.log
log needs rotating
considering log /home/deployer/abc/shared/log/nginx.error.log
log does not need rotating
considering log /home/deployer/abc/shared/log/production.delayed_job.log
log does not need rotating
considering log /home/deployer/abc/shared/log/production.log
log needs rotating
considering log /home/deployer/abc/shared/log/production.searchd.log
log does not need rotating
considering log /home/deployer/abc/shared/log/production.searchd.query.log
log does not need rotating
considering log /home/deployer/abc/shared/log/puma_access.log
log does not need rotating
considering log /home/deployer/abc/shared/log/puma_error.log
log does not need rotating
considering log /home/deployer/abc/shared/log/rake_ean_geocode.log
log does not need rotating
considering log /home/deployer/abc/shared/log/rake_ean_min_rate.log
log does not need rotating
considering log /home/deployer/abc/shared/log/rake_ean_update_spots.log
log does not need rotating
rotating log /home/deployer/abc/shared/log/nginx.access.log, log->rotateCount is 30
dateext suffix '-20160618'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /home/deployer/abc/shared/log/nginx.access.log.1 does not exist
renaming /home/deployer/abc/shared/log/nginx.access.log.30.gz to /home/deployer/abc/shared/log/nginx.access.log.31.gz (rotatecount 30, logstart 1, i 30),
renaming /home/deployer/abc/shared/log/nginx.access.log.29.gz to /home/deployer/abc/shared/log/nginx.access.log.30.gz (rotatecount 30, logstart 1, i 29),
renaming /home/deployer/abc/shared/log/nginx.access.log.28.gz to /home/deployer/abc/shared/log/nginx.access.log.29.gz (rotatecount 30, logstart 1, i 28),
renaming /home/deployer/abc/shared/log/nginx.access.log.27.gz to /home/deployer/abc/shared/log/nginx.access.log.28.gz (rotatecount 30, logstart 1, i 27),
renaming /home/deployer/abc/shared/log/nginx.access.log.26.gz to /home/deployer/abc/shared/log/nginx.access.log.27.gz (rotatecount 30, logstart 1, i 26),
renaming /home/deployer/abc/shared/log/nginx.access.log.25.gz to /home/deployer/abc/shared/log/nginx.access.log.26.gz (rotatecount 30, logstart 1, i 25),
renaming /home/deployer/abc/shared/log/nginx.access.log.24.gz to /home/deployer/abc/shared/log/nginx.access.log.25.gz (rotatecount 30, logstart 1, i 24),
renaming /home/deployer/abc/shared/log/nginx.access.log.23.gz to /home/deployer/abc/shared/log/nginx.access.log.24.gz (rotatecount 30, logstart 1, i 23),
renaming /home/deployer/abc/shared/log/nginx.access.log.22.gz to /home/deployer/abc/shared/log/nginx.access.log.23.gz (rotatecount 30, logstart 1, i 22),
renaming /home/deployer/abc/shared/log/nginx.access.log.21.gz to /home/deployer/abc/shared/log/nginx.access.log.22.gz (rotatecount 30, logstart 1, i 21),
renaming /home/deployer/abc/shared/log/nginx.access.log.20.gz to /home/deployer/abc/shared/log/nginx.access.log.21.gz (rotatecount 30, logstart 1, i 20),
renaming /home/deployer/abc/shared/log/nginx.access.log.19.gz to /home/deployer/abc/shared/log/nginx.access.log.20.gz (rotatecount 30, logstart 1, i 19),
renaming /home/deployer/abc/shared/log/nginx.access.log.18.gz to /home/deployer/abc/shared/log/nginx.access.log.19.gz (rotatecount 30, logstart 1, i 18),
renaming /home/deployer/abc/shared/log/nginx.access.log.17.gz to /home/deployer/abc/shared/log/nginx.access.log.18.gz (rotatecount 30, logstart 1, i 17),
renaming /home/deployer/abc/shared/log/nginx.access.log.16.gz to /home/deployer/abc/shared/log/nginx.access.log.17.gz (rotatecount 30, logstart 1, i 16),
renaming /home/deployer/abc/shared/log/nginx.access.log.15.gz to /home/deployer/abc/shared/log/nginx.access.log.16.gz (rotatecount 30, logstart 1, i 15),
renaming /home/deployer/abc/shared/log/nginx.access.log.14.gz to /home/deployer/abc/shared/log/nginx.access.log.15.gz (rotatecount 30, logstart 1, i 14),
renaming /home/deployer/abc/shared/log/nginx.access.log.13.gz to /home/deployer/abc/shared/log/nginx.access.log.14.gz (rotatecount 30, logstart 1, i 13),
renaming /home/deployer/abc/shared/log/nginx.access.log.12.gz to /home/deployer/abc/shared/log/nginx.access.log.13.gz (rotatecount 30, logstart 1, i 12),
renaming /home/deployer/abc/shared/log/nginx.access.log.11.gz to /home/deployer/abc/shared/log/nginx.access.log.12.gz (rotatecount 30, logstart 1, i 11),
renaming /home/deployer/abc/shared/log/nginx.access.log.10.gz to /home/deployer/abc/shared/log/nginx.access.log.11.gz (rotatecount 30, logstart 1, i 10),
renaming /home/deployer/abc/shared/log/nginx.access.log.9.gz to /home/deployer/abc/shared/log/nginx.access.log.10.gz (rotatecount 30, logstart 1, i 9),
renaming /home/deployer/abc/shared/log/nginx.access.log.8.gz to /home/deployer/abc/shared/log/nginx.access.log.9.gz (rotatecount 30, logstart 1, i 8),
renaming /home/deployer/abc/shared/log/nginx.access.log.7.gz to /home/deployer/abc/shared/log/nginx.access.log.8.gz (rotatecount 30, logstart 1, i 7),
renaming /home/deployer/abc/shared/log/nginx.access.log.6.gz to /home/deployer/abc/shared/log/nginx.access.log.7.gz (rotatecount 30, logstart 1, i 6),
renaming /home/deployer/abc/shared/log/nginx.access.log.5.gz to /home/deployer/abc/shared/log/nginx.access.log.6.gz (rotatecount 30, logstart 1, i 5),
renaming /home/deployer/abc/shared/log/nginx.access.log.4.gz to /home/deployer/abc/shared/log/nginx.access.log.5.gz (rotatecount 30, logstart 1, i 4),
renaming /home/deployer/abc/shared/log/nginx.access.log.3.gz to /home/deployer/abc/shared/log/nginx.access.log.4.gz (rotatecount 30, logstart 1, i 3),
renaming /home/deployer/abc/shared/log/nginx.access.log.2.gz to /home/deployer/abc/shared/log/nginx.access.log.3.gz (rotatecount 30, logstart 1, i 2),
renaming /home/deployer/abc/shared/log/nginx.access.log.1.gz to /home/deployer/abc/shared/log/nginx.access.log.2.gz (rotatecount 30, logstart 1, i 1),
renaming /home/deployer/abc/shared/log/nginx.access.log.0.gz to /home/deployer/abc/shared/log/nginx.access.log.1.gz (rotatecount 30, logstart 1, i 0),
copying /home/deployer/abc/shared/log/nginx.access.log to /home/deployer/abc/shared/log/nginx.access.log.1
truncating /home/deployer/abc/shared/log/nginx.access.log
removing old log /home/deployer/abc/shared/log/nginx.access.log.31.gz
error: error opening /home/deployer/abc/shared/log/nginx.access.log.31.gz: No such file or directory
rotating log /home/deployer/abc/shared/log/production.log, log->rotateCount is 30
dateext suffix '-20160618'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /home/deployer/abc/shared/log/production.log.1 does not exist
renaming /home/deployer/abc/shared/log/production.log.30.gz to /home/deployer/abc/shared/log/production.log.31.gz (rotatecount 30, logstart 1, i 30),
renaming /home/deployer/abc/shared/log/production.log.29.gz to /home/deployer/abc/shared/log/production.log.30.gz (rotatecount 30, logstart 1, i 29),
renaming /home/deployer/abc/shared/log/production.log.28.gz to /home/deployer/abc/shared/log/production.log.29.gz (rotatecount 30, logstart 1, i 28),
renaming /home/deployer/abc/shared/log/production.log.27.gz to /home/deployer/abc/shared/log/production.log.28.gz (rotatecount 30, logstart 1, i 27),
renaming /home/deployer/abc/shared/log/production.log.26.gz to /home/deployer/abc/shared/log/production.log.27.gz (rotatecount 30, logstart 1, i 26),
renaming /home/deployer/abc/shared/log/production.log.25.gz to /home/deployer/abc/shared/log/production.log.26.gz (rotatecount 30, logstart 1, i 25),
renaming /home/deployer/abc/shared/log/production.log.24.gz to /home/deployer/abc/shared/log/production.log.25.gz (rotatecount 30, logstart 1, i 24),
renaming /home/deployer/abc/shared/log/production.log.23.gz to /home/deployer/abc/shared/log/production.log.24.gz (rotatecount 30, logstart 1, i 23),
renaming /home/deployer/abc/shared/log/production.log.22.gz to /home/deployer/abc/shared/log/production.log.23.gz (rotatecount 30, logstart 1, i 22),
renaming /home/deployer/abc/shared/log/production.log.21.gz to /home/deployer/abc/shared/log/production.log.22.gz (rotatecount 30, logstart 1, i 21),
renaming /home/deployer/abc/shared/log/production.log.20.gz to /home/deployer/abc/shared/log/production.log.21.gz (rotatecount 30, logstart 1, i 20),
renaming /home/deployer/abc/shared/log/production.log.19.gz to /home/deployer/abc/shared/log/production.log.20.gz (rotatecount 30, logstart 1, i 19),
renaming /home/deployer/abc/shared/log/production.log.18.gz to /home/deployer/abc/shared/log/production.log.19.gz (rotatecount 30, logstart 1, i 18),
renaming /home/deployer/abc/shared/log/production.log.17.gz to /home/deployer/abc/shared/log/production.log.18.gz (rotatecount 30, logstart 1, i 17),
renaming /home/deployer/abc/shared/log/production.log.16.gz to /home/deployer/abc/shared/log/production.log.17.gz (rotatecount 30, logstart 1, i 16),
renaming /home/deployer/abc/shared/log/production.log.15.gz to /home/deployer/abc/shared/log/production.log.16.gz (rotatecount 30, logstart 1, i 15),
renaming /home/deployer/abc/shared/log/production.log.14.gz to /home/deployer/abc/shared/log/production.log.15.gz (rotatecount 30, logstart 1, i 14),
renaming /home/deployer/abc/shared/log/production.log.13.gz to /home/deployer/abc/shared/log/production.log.14.gz (rotatecount 30, logstart 1, i 13),
renaming /home/deployer/abc/shared/log/production.log.12.gz to /home/deployer/abc/shared/log/production.log.13.gz (rotatecount 30, logstart 1, i 12),
renaming /home/deployer/abc/shared/log/production.log.11.gz to /home/deployer/abc/shared/log/production.log.12.gz (rotatecount 30, logstart 1, i 11),
renaming /home/deployer/abc/shared/log/production.log.10.gz to /home/deployer/abc/shared/log/production.log.11.gz (rotatecount 30, logstart 1, i 10),
renaming /home/deployer/abc/shared/log/production.log.9.gz to /home/deployer/abc/shared/log/production.log.10.gz (rotatecount 30, logstart 1, i 9),
renaming /home/deployer/abc/shared/log/production.log.8.gz to /home/deployer/abc/shared/log/production.log.9.gz (rotatecount 30, logstart 1, i 8),
renaming /home/deployer/abc/shared/log/production.log.7.gz to /home/deployer/abc/shared/log/production.log.8.gz (rotatecount 30, logstart 1, i 7),
renaming /home/deployer/abc/shared/log/production.log.6.gz to /home/deployer/abc/shared/log/production.log.7.gz (rotatecount 30, logstart 1, i 6),
renaming /home/deployer/abc/shared/log/production.log.5.gz to /home/deployer/abc/shared/log/production.log.6.gz (rotatecount 30, logstart 1, i 5),
renaming /home/deployer/abc/shared/log/production.log.4.gz to /home/deployer/abc/shared/log/production.log.5.gz (rotatecount 30, logstart 1, i 4),
renaming /home/deployer/abc/shared/log/production.log.3.gz to /home/deployer/abc/shared/log/production.log.4.gz (rotatecount 30, logstart 1, i 3),
renaming /home/deployer/abc/shared/log/production.log.2.gz to /home/deployer/abc/shared/log/production.log.3.gz (rotatecount 30, logstart 1, i 2),
renaming /home/deployer/abc/shared/log/production.log.1.gz to /home/deployer/abc/shared/log/production.log.2.gz (rotatecount 30, logstart 1, i 1),
renaming /home/deployer/abc/shared/log/production.log.0.gz to /home/deployer/abc/shared/log/production.log.1.gz (rotatecount 30, logstart 1, i 0),
copying /home/deployer/abc/shared/log/production.log to /home/deployer/abc/shared/log/production.log.1
truncating /home/deployer/abc/shared/log/production.log
removing old log /home/deployer/abc/shared/log/production.log.31.gz
error: error opening /home/deployer/abc/shared/log/production.log.31.gz: No such file or directory
switching euid to 0 and egid to 0
rotating pattern: /var/log/syslog
after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/syslog
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/mail.info
log /var/log/mail.info does not exist -- skipping
considering log /var/log/mail.warn
log /var/log/mail.warn does not exist -- skipping
considering log /var/log/mail.err
log /var/log/mail.err does not exist -- skipping
considering log /var/log/mail.log
log /var/log/mail.log does not exist -- skipping
considering log /var/log/daemon.log
log /var/log/daemon.log does not exist -- skipping
considering log /var/log/kern.log
log does not need rotating
considering log /var/log/auth.log
log does not need rotating
considering log /var/log/user.log
log /var/log/user.log does not exist -- skipping
considering log /var/log/lpr.log
log /var/log/lpr.log does not exist -- skipping
considering log /var/log/cron.log
log /var/log/cron.log does not exist -- skipping
considering log /var/log/debug
log /var/log/debug does not exist -- skipping
considering log /var/log/messages
log /var/log/messages does not exist -- skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/ufw.log
weekly (4 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/ufw.log
log /var/log/ufw.log does not exist -- skipping
not running postrotate script, since no logs were rotated
switching euid to 0 and egid to 0
rotating pattern: /var/log/unattended-upgrades/unattended-upgrades.log
/var/log/unattended-upgrades/unattended-upgrades-shutdown.log
monthly (6 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/unattended-upgrades/unattended-upgrades.log
log /var/log/unattended-upgrades/unattended-upgrades.log does not exist -- skipping
considering log /var/log/unattended-upgrades/unattended-upgrades-shutdown.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/upstart/*.log after 1 days (7 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/upstart/acpid.log
log does not need rotating
considering log /var/log/upstart/nginx.log
log does not need rotating
considering log /var/log/upstart/rsyslog.log
log does not need rotating
considering log /var/log/upstart/systemd-logind.log
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/wtmp monthly (1 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/wtmp
log does not need rotating
switching euid to 0 and egid to 0
rotating pattern: /var/log/btmp monthly (1 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 104
considering log /var/log/btmp
log does not need rotating
switching euid to 0 and egid to 0
Но мои журналы приложений по-прежнему не меняются:
deployer@qapp01:~/abc/current/log$ ll
total 1227256
drwxrwxr-x 2 deployer deployer 4096 Jun 18 15:53 ./
drwxrwxr-x 11 deployer deployer 4096 Jun 18 11:18 ../
-rw-rw-r-- 1 deployer deployer 574462 Jun 18 15:54 newrelic_agent.log
-rw-r--r-- 1 root root 25550727 Jun 18 15:55 nginx.access.log
-rw-r--r-- 1 root root 0 Jun 18 00:13 nginx.error.log
-rw-rw-r-- 1 deployer deployer 4455 Jun 18 15:44 production.delayed_job.log
-rw-rw-r-- 1 deployer deployer 1230525588 Jun 18 15:55 production.log
-rw------- 1 deployer deployer 6798 Jun 18 11:35 production.searchd.log
-rw------- 1 deployer deployer 6302 Jun 18 15:44 production.searchd.query.log
-rw-rw-r-- 1 deployer deployer 120 Jun 18 00:30 puma_access.log
-rw-rw-r-- 1 deployer deployer 48 Jun 18 00:30 puma_error.log
-rw-rw-r-- 1 deployer deployer 0 Jun 17 12:16 rake_ean_geocode.log
-rw-rw-r-- 1 deployer deployer 0 Jun 17 12:16 rake_ean_min_rate.log
-rw-rw-r-- 1 deployer deployer 0 Jun 17 12:16 rake_ean_update_spots.log
Я не понимаю, даже после поиска в Google различных решений, но безрезультатно.
Вы указали оба size
и daily
в вашей конфигурации для этих файлов журнала. Насколько я понимаю, size
вызывает любое вращение на основе времени (см. похожие вопросы здесь - этот например).
Исходя из этого, единственные файлы, которые я ожидал бы повернуть прямо сейчас, это production.log
и nginx.access.log
. Результат вашего отладочного запуска с использованием sudo
показывает, что logrotate
действительно повернул бы эти файлы.
Помните, что при работе с -d
logrotate
не буду вносить никаких изменений. Если вам нужна дополнительная информация о том, что происходит, а также внесение изменений, используйте -v
вместо.
Обратите внимание, что (в общем) logrotate
рассчитывает работать как root
. Обратите внимание, что вы не получаете предупреждений о switching euid
при работе через sudo
.
Вот как у меня это заработало:
size
или daily
./etc/logrotate.d/abc
принадлежит root
- sudo chown root:root /etc/logrotate.d/abc
./etc/logrotate.d/abc
имеет разрешение 644 по крайней мере - sudo chmod 644 /etc/logrotate.d/abc
./etc/logrotate.d/abc
с правом пользователя. Например, мои файлы журнала принадлежат deployer:deployer
, затем добавляю su deployer deployer
к /etc/logrotate.d/abc
.