linux系统核心日志是在/var/log/messages中的 [root@wangxiangzhe ~]# ls /var/log/messages* /var/log/messages /var/log/messages-20151011 /var/log/messages-20150928 /var/log/messages-20151019 /var/log/messages-20151004 /日志是以日期的名字命名的
linux系统日志配置文件是在/etc/logrotate.conf中的
[root@wangxiangzhe ~]# vim /etc/logrotate.conf # see "man logrotate" for details # rotate log files weekly weekly (表示日志每一周切割一次) # keep 4 weeks worth of backlogs rotate 4 (保留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 { //var/log/wtmp用来查看用户的登陆历史,这个日志不能用cat来看,只能 用last查看\ monthly (按月份归档) create 0664 root utmp (创建目录的权限,属主和属组) minsize 1M (最小为1M) rotate 1 (保留一个) } /var/log/btmp { //这个日志与wtmp类似,用lstab查看,记录无效登录历史、 missingok monthly create 0600 root utmp rotate 1 } # system-specific logs may be also be configured here.
原文:http://zidingyi.blog.51cto.com/10735263/1706414