我正在尝试在我的流式传输作业中实现日志轮换。这是我的测试配置文件。
/home/hadoop/first* {
daily
rotate 3
size 1M
compress
delaycompress
}
当我尝试运行 logrotate 时,所发生的只是日志文件 first_run.out 附加了 .1 文件未拆分并且 zip 不会发生在拆分文件中。
编辑:当我尝试使用 -v 选项时,我得到了这个日志
[hadoop@ip-10-27-90-253 ~]$ sudo logrotate -vf /etc/logrotate.d/apache2.conf
reading config file /etc/logrotate.d/apache2.conf
reading config info for /home/hadoop/first*
Handling 1 logs
rotating pattern: /home/hadoop/first* forced from command line (3 rotations)
empty log files are rotated, old logs are removed
considering log /home/hadoop/first_run.out.1.1.1.1.1.1
log needs rotating
rotating log /home/hadoop/first_run.out.1.1.1.1.1.1, log->rotateCount is 3
dateext suffix '-20190411'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /home/hadoop/first_run.out.1.1.1.1.1.1.1 does not exist
renaming /home/hadoop/first_run.out.1.1.1.1.1.1.3.gz to /home/hadoop/first_run.out.1.1.1.1.1.1.4.gz (rotatecount 3, logstart 1, i 3),
old log /home/hadoop/first_run.out.1.1.1.1.1.1.3.gz does not exist
renaming /home/hadoop/first_run.out.1.1.1.1.1.1.2.gz to /home/hadoop/first_run.out.1.1.1.1.1.1.3.gz (rotatecount 3, logstart 1, i 2),
old log /home/hadoop/first_run.out.1.1.1.1.1.1.2.gz does not exist
renaming /home/hadoop/first_run.out.1.1.1.1.1.1.1.gz to /home/hadoop/first_run.out.1.1.1.1.1.1.2.gz (rotatecount 3, logstart 1, i 1),
old log /home/hadoop/first_run.out.1.1.1.1.1.1.1.gz does not exist
renaming /home/hadoop/first_run.out.1.1.1.1.1.1.0.gz to /home/hadoop/first_run.out.1.1.1.1.1.1.1.gz (rotatecount 3, logstart 1, i 0),
old log /home/hadoop/first_run.out.1.1.1.1.1.1.0.gz does not exist
log /home/hadoop/first_run.out.1.1.1.1.1.1.4.gz doesn't exist -- won't try to dispose of it
renaming /home/hadoop/first_run.out.1.1.1.1.1.1 to /home/hadoop/first_run.out.1.1.1.1.1.1.1