logrotate không thể xoay các bản ghi của tôi. Tôi đã kiểm tra quyền truy cập tập tin, họ vẫn ổn.
Tôi thậm chí đã thử bằng cách đặt "su root root" trong tệp cấu hình, tôi vẫn gặp phải vấn đề tương tự.
Vui lòng tìm các chi tiết có liên quan dưới đây:
tệp logrotate.conf:
/var/log/testlog {
compress
delaycompress
dateext
maxage 180
rotate 15
size 1024M
start 1
rotate 15
missingok
}
Nhật ký gỡ lỗi: [Sử dụng tùy chọn "-d"]
rotating pattern: /var/log/testlog 1073741824 bytes (15 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/testlog
log needs rotating
rotating log /var/log/testlog, log->rotateCount is 15
dateext suffix '-20140708'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/testlog.15.gz to /var/log/testlog.16.gz (rotatecount 15, logstart 1, i 15),
renaming /var/log/testlog.14.gz to /var/log/testlog.15.gz (rotatecount 15, logstart 1, i 14),
renaming /var/log/testlog.13.gz to /var/log/testlog.14.gz (rotatecount 15, logstart 1, i 13),
renaming /var/log/testlog.12.gz to /var/log/testlog.13.gz (rotatecount 15, logstart 1, i 12),
renaming /var/log/testlog.11.gz to /var/log/testlog.12.gz (rotatecount 15, logstart 1, i 11),
renaming /var/log/testlog.10.gz to /var/log/testlog.11.gz (rotatecount 15, logstart 1, i 10),
renaming /var/log/testlog.9.gz to /var/log/testlog.10.gz (rotatecount 15, logstart 1, i 9),
renaming /var/log/testlog.8.gz to /var/log/testlog.9.gz (rotatecount 15, logstart 1, i 8),
renaming /var/log/testlog.7.gz to /var/log/testlog.8.gz (rotatecount 15, logstart 1, i 7),
renaming /var/log/testlog.6.gz to /var/log/testlog.7.gz (rotatecount 15, logstart 1, i 6),
renaming /var/log/testlog.5.gz to /var/log/testlog.6.gz (rotatecount 15, logstart 1, i 5),
renaming /var/log/testlog.4.gz to /var/log/testlog.5.gz (rotatecount 15, logstart 1, i 4),
renaming /var/log/testlog.3.gz to /var/log/testlog.4.gz (rotatecount 15, logstart 1, i 3),
renaming /var/log/testlog.2.gz to /var/log/testlog.3.gz (rotatecount 15, logstart 1, i 2),
renaming /var/log/testlog.1.gz to /var/log/testlog.2.gz (rotatecount 15, logstart 1, i 1),
renaming /var/log/testlog.0.gz to /var/log/testlog.1.gz (rotatecount 15, logstart 1, i 0),
renaming /var/log/testlog to /var/log/testlog.1
removing old log /var/log/testlog.16.gz
error: error opening /var/log/testlog.16.gz: No such file or directory
Báo cáo dài dòng:
rotating pattern: /var/log/testlog 1073741824 bytes (15 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/testlog
log needs rotating
rotating log /var/log/testlog, log->rotateCount is 15
dateext suffix '-20140625'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/testlog.15.gz to /var/log/testlog.16.gz (rotatecount 15, logstart 1, i 15),
old log /var/log/testlog.15.gz does not exist
renaming /var/log/testlog.14.gz to /var/log/testlog.15.gz (rotatecount 15, logstart 1, i 14),
old log /var/log/testlog.14.gz does not exist
renaming /var/log/testlog.13.gz to /var/log/testlog.14.gz (rotatecount 15, logstart 1, i 13),
old log /var/log/testlog.13.gz does not exist
renaming /var/log/testlog.12.gz to /var/log/testlog.13.gz (rotatecount 15, logstart 1, i 12),
old log /var/log/testlog.12.gz does not exist
renaming /var/log/testlog.11.gz to /var/log/testlog.12.gz (rotatecount 15, logstart 1, i 11),
old log /var/log/testlog.11.gz does not exist
renaming /var/log/testlog.10.gz to /var/log/testlog.11.gz (rotatecount 15, logstart 1, i 10),
old log /var/log/testlog.10.gz does not exist
renaming /var/log/testlog.9.gz to /var/log/testlog.10.gz (rotatecount 15, logstart 1, i 9),
old log /var/log/testlog.9.gz does not exist
renaming /var/log/testlog.8.gz to /var/log/testlog.9.gz (rotatecount 15, logstart 1, i 8),
old log /var/log/testlog.8.gz does not exist
renaming /var/log/testlog.7.gz to /var/log/testlog.8.gz (rotatecount 15, logstart 1, i 7),
old log /var/log/testlog.7.gz does not exist
renaming /var/log/testlog.6.gz to /var/log/testlog.7.gz (rotatecount 15, logstart 1, i 6),
old log /var/log/testlog.6.gz does not exist
renaming /var/log/testlog.5.gz to /var/log/testlog.6.gz (rotatecount 15, logstart 1, i 5),
old log /var/log/testlog.5.gz does not exist
renaming /var/log/testlog.4.gz to /var/log/testlog.5.gz (rotatecount 15, logstart 1, i 4),
old log /var/log/testlog.4.gz does not exist
renaming /var/log/testlog.3.gz to /var/log/testlog.4.gz (rotatecount 15, logstart 1, i 3),
old log /var/log/testlog.3.gz does not exist
renaming /var/log/testlog.2.gz to /var/log/testlog.3.gz (rotatecount 15, logstart 1, i 2),
old log /var/log/testlog.2.gz does not exist
renaming /var/log/testlog.1.gz to /var/log/testlog.2.gz (rotatecount 15, logstart 1, i 1),
renaming /var/log/testlog.0.gz to /var/log/testlog.1.gz (rotatecount 15, logstart 1, i 0),
old log /var/log/testlog.0.gz does not exist
log /var/log/testlog.16.gz doesn't exist -- won't try to dispose of it
renaming /var/log/testlog to /var/log/testlog.1
Đầu ra của ls / var / log / testlog *:
/var/log/testlog
/var/log/testlog.1
/var/log/testlog.2.gz
'Testlog' là tên của tệp nhật ký được đặt tại / var / log /. Tôi đang gọi 'logrotate' trực tiếp từ dòng lệnh như sau:
logrotate logrotate.conf [tệp conf của riêng tôi, nội dung được sao chép ở trên]
Ai đó có thể vui lòng cung cấp cho tôi một số gợi ý để giải quyết vấn đề này?
Cảm ơn
logrotate 3.7.8
trên Ubuntu