首页 > 代码库 > logstate配置文件
logstate配置文件
logrotate命令用于对系统日志进行轮转、压缩和删除,也可以将日志发送到指定邮箱。
每个记录文件都可被设置成每日,每周或每月处理,也能在文件太大时立即处理。
# 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
}
/usr/local/tomcat/logs/catalina.out{
copytruncate
daily
dateext
rotate 5
missingok
size 50M
}
/usr/local/tomcat/logs/contacts-service.log{
copytruncate 用于还在打开中的日志文件,把当前日志备份并截断
daily 指定转储周期为每天
dateext 归档老版本的日志文件添加一个日期
rotate 5
missingok 如果日志文件丢失继续下一个不发布一个错误消息
size 50M 当日志文件到达指定的大小时才转储
}
# system-specific logs may be also be configured here.
本文出自 “小V运维之路” 博客,请务必保留此出处http://victor2016.blog.51cto.com/6768693/1919870
logstate配置文件