Modify CentOS6 log cycle
CentOS6 logs are kept for 4 weeks by default, which is too short. In order to keep the log longer, the modification period is 24 months from 4 weeks.
1. Modify configuration 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
two。 Restart the service 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. Show Log
-- # 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 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 murf = "http://www.rsyslog.com"] start"