CentOS6日志缺省保存4周,时间太短。为了保存log更久,从4周修改周期为24个月。
1.修改配置logrotate.conf
[root@D65 etc]# vi /etc/logrotate.conf
--# rotate log files weekly
##weekly
monthly
--# keep 4 weeks worth of backlogs
##rotate 4
rotate 24
2.重启服务syslog
[root@D65 etc]# service rsyslog restart
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
[root@D65 etc]# service --status-all |grep log
query logging is ON
rsyslogd (pid 5342) is running...
3.显示日志
--# tail /var/log/messages
[root@D65 etc]# tailf /var/log/messages
Sep 12 10:44:58 D65 kernel: Kernel logging (proc) stopped.
Sep 12 10:44:58 D65 rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-
pid="1361" x-info="http://www.rsyslog.com"] exiting on signal 15.
Sep 12 10:44:58 D65 kernel: imklog 5.8.10, log source = /proc/kmsg started.
Sep 12 10:44:58 D65 rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-
pid="5342" x-info="http://www.rsyslog.com"] start
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。