Wie kann man die Datei catalina.out stündlich in /usr/local/tomcat8/logs/catalina.out logrotieren?

305
arch

Ich habe das Skript für logrotate in /etc/logrotate.d/tomcat8 erstellt. Unten ist das Skript in tomcat8:

/usr/local/tomcat8/logs/catalina.out{ copytruncate size = 100k hourly rotate 24 missingok notifempty create compress postrotate endscript } 

Für die Datei ... /etc/logrotate.conf

# see "man logrotate" for details size 1  # keep 4 weeks worth of backlogs rotate 1  # create new (empty) log files after rotating old ones create  # use date as a suffix of the rotated file dateext dateformat -%Y-%m-%d-%s  # 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. 

Dann wechselte ich logrotate von cron.daily nach cron.stündlich:

mv /etc/cron.daily/logrotate /etc/cron.hourly 

Danach fügte ich das Skript hinzu, das in crontab (Scheduling cronjob) ausgeführt werden sollte:

SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/  # m h dom mon dow user 0 * * * * root /usr/sbin/logrotate /etc/logrotate.d/tomcat8 

Dies funktioniert nicht für die stündliche Rotation. Kann mir jemand bei der Implementierung der täglichen Rotation helfen, zu wissen, wie die Rotation auf Stundenebene funktioniert?

0

0 Antworten auf die Frage