Logrotate syslog-NG 日志记录 - RHEL 7.x

Logrotate syslog-NG 日志记录 - RHEL 7.x

/usr/sbin/logrotate用于记录rotate syslog-NG日志记录,如下所示:

[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# 
[root@machine1 output]#
[root@machine1 output]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
[root@machine1 output]#
[root@machine1 output]#

但是,我没有看到../output文件夹中每分钟生成压缩文件(crontab)。

为什么logrotate不生成压缩文件?

相关内容