文章正文
日志-logrotate切割tomcat日志
【文章】2020-04-23
简介日志-logrotate切割tomcat日志
logrotate --help
用法: logrotate [OPTION...] <configfile>
-d, --debug Don't do anything, just test (implies -v)
-f, --force Force file rotation
-m, --mail=command Command to send mail (instead of `/bin/mail')
-s, --state=statefile Path of state file
-v, --verbose Display messages during rotation
-l, --log=STRING Log file
--version Display version information
Help options:
-?, --help Show this help message
--usage Display brief usage message
-- 脚本
[root@localhost ~]# cat /etc/logrotate.d/tomcat
/opt/java/apache-tomcat-8.0.20/logs/*{
daily
copytruncate
rotate 5
compress
notifempty
dateext
missingok
#size 5M
}
-- 分割日志
logrotate -v -f -m /etc/logrotate.d/tomcat
logrotate -f /etc/logrotate.d/tomcat
-- 查看任务日志:
cat /var/log/cron
cat /var/lib/logrotate.status
vi /etc/crontab
vi /etc/logrotate.d/tomcat
/etc/init.d/crond restart
[tabalt@localhost ~] sudo /usr/sbin/logrotate -v -f -d /usr/local/nginx/conf/logrotate.conf
service crond restart
/usr/sbin/logrotate -v -f -d /etc/logrotate.conf
打赏支持
感谢您的支持,我会继续努力的!

打开微信扫码打赏,你说多少就多少
找书费时,联系客服快速查找!

在线客服8:30-23:00,若离线请留言!
获取教程,请联系在线客服!

在线客服8:30-23:00,若离线请留言!
找PDF电子书,太费时间?
- 微信扫描二维码,让客服快速查找。

在线客服8:30-23:00,若离线请留言!