/usr/sbin/logrotate
é usado para registrar a rotação do registro syslog-NG, conforme mostrado abaixo:
[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]#
Mas, não vejo o arquivo compactado sendo gerado na pasta ../output
, a cada minuto (crontab).
porque logrotate
não gera arquivo compactado ??