LINUX.ORG.RU

История изменений

Исправление KOTOXJle6, (текущая версия) :

Попробовал принудительно выполнить очистку через logrotate -f /etc/logrotate.d/squid -d. Вижу что скрипт отрабатывает:


rotating pattern: /ClFS/squid/logs/access.log  forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /ClFS/squid/logs/access.log
  Now: 2019-12-10 15:21
  Last rotated at 2019-12-10 15:19
  log needs rotating
rotating log /ClFS/squid/logs/access.log, log->rotateCount is 5
dateext suffix '-20191210'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /ClFS/squid/logs/access.log.5.gz to /ClFS/squid/logs/access.log.6.gz (rotatecount 5, logstart 1, i 5),
renaming /ClFS/squid/logs/access.log.4.gz to /ClFS/squid/logs/access.log.5.gz (rotatecount 5, logstart 1, i 4),
renaming /ClFS/squid/logs/access.log.3.gz to /ClFS/squid/logs/access.log.4.gz (rotatecount 5, logstart 1, i 3),
renaming /ClFS/squid/logs/access.log.2.gz to /ClFS/squid/logs/access.log.3.gz (rotatecount 5, logstart 1, i 2),
renaming /ClFS/squid/logs/access.log.1.gz to /ClFS/squid/logs/access.log.2.gz (rotatecount 5, logstart 1, i 1),
renaming /ClFS/squid/logs/access.log.0.gz to /ClFS/squid/logs/access.log.1.gz (rotatecount 5, logstart 1, i 0),
log /ClFS/squid/logs/access.log.6.gz doesn't exist -- won't try to dispose of it
renaming /ClFS/squid/logs/access.log to /ClFS/squid/logs/access.log.1
creating new /ClFS/squid/logs/access.log mode = 0640 uid = 13 gid = 13

Но в директориях старые файлы остаются, ничего не удаляется.

root@squid-01:/home/stb# ls -la /ClFS/squid/logs/
total 30885642
drwxr-xr-x 2 proxy proxy       4096 дек 10 15:19 .
drwxr-xr-x 5 proxy proxy       4096 дек  6 08:49 ..
-rw-r----- 1 proxy proxy  128687334 дек 10 15:35 access.log
-rw-r----- 1 proxy proxy          0 дек 10 15:19 access.log.0
-rw-r----- 1 root  root   312210822 сен  9 07:47 access.log.06-09.09
-rw-r----- 1 proxy proxy   65811620 ноя 25 06:25 access.log.12.gz
-rw-r----- 1 proxy proxy   61090187 ноя 24 06:25 access.log.13.gz
-rw-r----- 1 proxy proxy  234014030 ноя 23 06:25 access.log.14.gz
-rw-r----- 1 proxy proxy   15891869 дек 10 15:19 access.log.1.gz
-rw-r----- 1 proxy proxy  120616827 дек 10 15:19 access.log.2
-rw-r----- 1 proxy proxy 3550927790 дек 10 15:04 access.log.3
-rw-r----- 1 proxy proxy  764099836 дек 10 06:25 access.log.3.gz
-rw-r----- 1 proxy proxy 6474753207 дек 10 06:25 access.log.4
-rw-r----- 1 proxy proxy  234113705 дек  9 06:25 access.log.4.gz
-rw-r----- 1 proxy proxy 3063272437 дек  9 06:25 access.log.5
-rw-r----- 1 proxy proxy  247080271 дек  8 06:25 access.log.5.gz
-rw-r----- 1 proxy proxy 3125321940 дек  8 06:25 access.log.6
-rw-r----- 1 proxy proxy 5311918958 дек  7 06:25 access.log.7
-rw-r----- 1 proxy proxy  248557571 ноя 30 06:25 access.log.7.gz
-rw-r----- 1 proxy proxy 5469450324 дек  6 06:25 access.log.8
-rw-r----- 1 proxy proxy 2199066411 дек  5 06:25 access.log.9

Все верно и я не так понял принцип работы logrotate или все же файлы должны быть удалены?

Исходная версия KOTOXJle6, :

Попробовал принудительно выполнить очистку через logrotate -f /etc/logrotate.d/squid -d. Вижу что скрипт отрабатывает:

rrotating pattern: /ClFS/squid/logs/access.log  forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /ClFS/squid/logs/access.log
  Now: 2019-12-10 15:21
  Last rotated at 2019-12-10 15:19
  log needs rotating
rotating log /ClFS/squid/logs/access.log, log->rotateCount is 5
dateext suffix '-20191210'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /ClFS/squid/logs/access.log.5.gz to /ClFS/squid/logs/access.log.6.gz (rotatecount 5, logstart 1, i 5),
renaming /ClFS/squid/logs/access.log.4.gz to /ClFS/squid/logs/access.log.5.gz (rotatecount 5, logstart 1, i 4),
renaming /ClFS/squid/logs/access.log.3.gz to /ClFS/squid/logs/access.log.4.gz (rotatecount 5, logstart 1, i 3),
renaming /ClFS/squid/logs/access.log.2.gz to /ClFS/squid/logs/access.log.3.gz (rotatecount 5, logstart 1, i 2),
renaming /ClFS/squid/logs/access.log.1.gz to /ClFS/squid/logs/access.log.2.gz (rotatecount 5, logstart 1, i 1),
renaming /ClFS/squid/logs/access.log.0.gz to /ClFS/squid/logs/access.log.1.gz (rotatecount 5, logstart 1, i 0),
log /ClFS/squid/logs/access.log.6.gz doesn't exist -- won't try to dispose of it
renaming /ClFS/squid/logs/access.log to /ClFS/squid/logs/access.log.1
creating new /ClFS/squid/logs/access.log mode = 0640 uid = 13 gid = 13
[\code]

Но в директориях старые файлы остаются, ничего не удаляется.

[сode]
root@squid-01:/home/stb# ls -la /ClFS/squid/logs/
total 30885642
drwxr-xr-x 2 proxy proxy       4096 дек 10 15:19 .
drwxr-xr-x 5 proxy proxy       4096 дек  6 08:49 ..
-rw-r----- 1 proxy proxy  128687334 дек 10 15:35 access.log
-rw-r----- 1 proxy proxy          0 дек 10 15:19 access.log.0
-rw-r----- 1 root  root   312210822 сен  9 07:47 access.log.06-09.09
-rw-r----- 1 proxy proxy   65811620 ноя 25 06:25 access.log.12.gz
-rw-r----- 1 proxy proxy   61090187 ноя 24 06:25 access.log.13.gz
-rw-r----- 1 proxy proxy  234014030 ноя 23 06:25 access.log.14.gz
-rw-r----- 1 proxy proxy   15891869 дек 10 15:19 access.log.1.gz
-rw-r----- 1 proxy proxy  120616827 дек 10 15:19 access.log.2
-rw-r----- 1 proxy proxy 3550927790 дек 10 15:04 access.log.3
-rw-r----- 1 proxy proxy  764099836 дек 10 06:25 access.log.3.gz
-rw-r----- 1 proxy proxy 6474753207 дек 10 06:25 access.log.4
-rw-r----- 1 proxy proxy  234113705 дек  9 06:25 access.log.4.gz
-rw-r----- 1 proxy proxy 3063272437 дек  9 06:25 access.log.5
-rw-r----- 1 proxy proxy  247080271 дек  8 06:25 access.log.5.gz
-rw-r----- 1 proxy proxy 3125321940 дек  8 06:25 access.log.6
-rw-r----- 1 proxy proxy 5311918958 дек  7 06:25 access.log.7
-rw-r----- 1 proxy proxy  248557571 ноя 30 06:25 access.log.7.gz
-rw-r----- 1 proxy proxy 5469450324 дек  6 06:25 access.log.8
-rw-r----- 1 proxy proxy 2199066411 дек  5 06:25 access.log.9

Все верно и я не так понял принцип работы logrotate или все же файлы должны быть удалены?