LINUX.ORG.RU
ФорумAdmin

logrotate тупо не работает

 ,


0

1

Он не работает. Что делать?

Ах, да, конфиг:

cat /etc/logrotate.d/apache2
/var/log/apache2/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
#       notifempty
        create 640 www-data root
        sharedscripts
        postrotate
                /etc/init.d/apache2 reload > /dev/null
        endscript
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi; \
        endscript
}
Это для апача.

Запускаю:

reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apache2
...

Handling 17 logs

rotating pattern: /var/log/apache2/*.log  forced from command line (52 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/apache2/access.log
  log needs rotating
considering log /var/log/apache2/ad-access.log
  log needs rotating
considering log /var/log/apache2/error.log
  log needs rotating
considering log /var/log/apache2/other_vhosts_access.log
  log needs rotating
considering log /var/log/apache2/vote.log
  log needs rotating
considering log /var/log/apache2/wiki-access.log
  log needs rotating
rotating log /var/log/apache2/access.log, log->rotateCount is 52
dateext suffix '-20141002'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/apache2/access.log.1 does not exist
renaming /var/log/apache2/access.log.52.gz to /var/log/apache2/access.log.53.gz (rotatecount 52, logstart 1, i 52),
renaming /var/log/apache2/access.log.51.gz to /var/log/apache2/access.log.52.gz (rotatecount 52, logstart 1, i 51),
renaming /var/log/apache2/access.log.50.gz to /var/log/apache2/access.log.51.gz (rotatecount 52, logstart 1, i 50),
renaming /var/log/apache2/access.log.49.gz to /var/log/apache2/access.log.50.gz (rotatecount 52, logstart 1, i 49),
...
renaming /var/log/apache2/access.log.9.gz to /var/log/apache2/access.log.10.gz (rotatecount 52, logstart 1, i 9),
renaming /var/log/apache2/access.log.8.gz to /var/log/apache2/access.log.9.gz (rotatecount 52, logstart 1, i 8),
old log /var/log/apache2/access.log.8.gz does not exist
renaming /var/log/apache2/access.log.7.gz to /var/log/apache2/access.log.8.gz (rotatecount 52, logstart 1, i 7),
old log /var/log/apache2/access.log.7.gz does not exist
renaming /var/log/apache2/access.log.6.gz to /var/log/apache2/access.log.7.gz (rotatecount 52, logstart 1, i 6),
old log /var/log/apache2/access.log.6.gz does not exist
renaming /var/log/apache2/access.log.5.gz to /var/log/apache2/access.log.6.gz (rotatecount 52, logstart 1, i 5),
old log /var/log/apache2/access.log.5.gz does not exist
renaming /var/log/apache2/access.log.4.gz to /var/log/apache2/access.log.5.gz (rotatecount 52, logstart 1, i 4),
old log /var/log/apache2/access.log.4.gz does not exist
renaming /var/log/apache2/access.log.3.gz to /var/log/apache2/access.log.4.gz (rotatecount 52, logstart 1, i 3),
old log /var/log/apache2/access.log.3.gz does not exist
renaming /var/log/apache2/access.log.2.gz to /var/log/apache2/access.log.3.gz (rotatecount 52, logstart 1, i 2),
old log /var/log/apache2/access.log.2.gz does not exist
renaming /var/log/apache2/access.log.1.gz to /var/log/apache2/access.log.2.gz (rotatecount 52, logstart 1, i 1),
old log /var/log/apache2/access.log.1.gz does not exist
renaming /var/log/apache2/access.log.0.gz to /var/log/apache2/access.log.1.gz (rotatecount 52, logstart 1, i 0),
old log /var/log/apache2/access.log.0.gz does not exist
rotating log /var/log/apache2/ad-access.log, log->rotateCount is 52
...
В результате:
ls -v1 /var/log/apache2/access.log*
/var/log/apache2/access.log
/var/log/apache2/access.log.10.gz
/var/log/apache2/access.log.11.gz
/var/log/apache2/access.log.12.gz
/var/log/apache2/access.log.13.gz
/var/log/apache2/access.log.14.gz
...
то есть наличие изначального access.log просто игнорируется.

Debian GNU/Linux 7.6 (wheezy), logrotate 3.8.1-4

★★★★

Последнее исправление: muon (всего исправлений: 1)

Ниче не игнорируется. Все сделано корректно. Что тебя не устраивает? Потеря log.1? Размер access.log не изменился?

gh0stwizard ★★★★★
()
Ответ на: комментарий от alozovskoy
weekly
rotate 4
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
}
muon ★★★★
() автор топика
Ответ на: комментарий от gh0stwizard

Что тебя не устраивает? Потеря log.1? Размер access.log не изменился?

Да. Размер изменился, и флажок force стоит. А больше всего вот это напрягает:

renaming /var/log/apache2/access.log.0.gz to /var/log/apache2/access.log.1.gz (rotatecount 52, logstart 1, i 0),
old log /var/log/apache2/access.log.0.gz does not exist
Зачем ему access.log.0.gz, почему не access.log.

muon ★★★★
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.