rsyslog 直接kill进程,在重新启动会全部发送日志

jrhapt11:/root# ps -ef | grep rsyslog
root      8233     1  0 17:42 ?        00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid
root      8342  8147  0 17:43 pts/1    00:00:00 grep rsyslog
jrhapt11:/root# kill -9 8233
You have mail in /var/spool/mail/root
jrhapt11:/root# service rsyslog start
Starting system logger:                                    [  OK  ]
jrhapt11:/root# 

这种方式 日志会全部重发

/***

jrhapt11:/root# service rsyslog stop
Shutting down system logger:                               [  OK  ]
jrhapt11:/root# service rsyslog start
Starting system logger:                                    [  OK  ]


这种情况日志不会重发


/*****测试;

jrhwpt01:/root# ps -ef | grep rsyslog
root      8504  8375  0 17:59 pts/1    00:00:00 grep rsyslog
root     22665     1  0 15:54 ?        00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid
jrhwpt01:/root# cd /var/log/nginx/
jrhwpt01:/var/log/nginx# wc -l error.log 
26 error.log

jrhwpt01:/var/log/nginx# kill -9 22665
jrhwpt01:/var/log/nginx# wc -l error.log 
26 error.log
jrhwpt01:/var/log/nginx# ps -ef | grep rsyslog
root      8534  8375  0 17:59 pts/1    00:00:00 grep rsyslog
jrhwpt01:/var/log/nginx# service rsyslog start
Starting system logger:                                    [  OK  ]
jrhwpt01:/var/log/nginx# ps -ef | grep rsyslog
root      8545     1  0 17:59 ?        00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid
root      8561  8375  0 17:59 pts/1    00:00:00 grep rsyslog


[root@dr-mysql01 zjzc_log]# cat  zj-frontend01-error.2016-09-26 
[root@dr-mysql01 zjzc_log]# cat  zj-frontend01-error.2016-09-26 
 2016/09/26 16:04:04 [error] 23060#0: *1325 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.171.246.184, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn", referrer: "https://www.zjcap.cn/wechat/home.html?useragent=android_h5_zjcap&apiver=2"
 2016/09/26 16:05:01 [error] 23060#0: *1364 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.171.246.184, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn", referrer: "https://www.zjcap.cn/wechat/safe.html?useragent=android_h5_zjcap"
 2016/09/26 16:21:06 [error] 23060#0: *1406 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.252.142.174, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn"
 2016/09/26 16:25:06 [error] 23060#0: *1433 open() "/var/www/zjzc-web-
 
 
 
 /*****
 
 此时rsyslog 服务器上:
 [root@dr-mysql01 zjzc_log]# grep '2016/09/26 16:04:04' zj-frontend01-error.2016-09-26 
 2016/09/26 16:04:04 [error] 23060#0: *1325 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.171.246.184, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn", referrer: "https://www.zjcap.cn/wechat/home.html?useragent=android_h5_zjcap&apiver=2"
 
 
 
 kill进程:
 jrhwpt01:/var/log/nginx# ps -ef | grep rsyslog
root      8545     1  0 17:59 ?        00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid
root      9485  8375  0 18:05 pts/1    00:00:00 grep rsyslog
You have mail in /var/spool/mail/root
jrhwpt01:/var/log/nginx# kill -9 8545

jrhwpt01:/var/log/nginx# ps -ef | grep rsyslog
root      9487  8375  0 18:05 pts/1    00:00:00 grep rsyslog
jrhwpt01:/var/log/nginx# service rsyslog start
Starting system logger:                                    [  OK  ]


[root@dr-mysql01 zjzc_log]# grep '2016/09/26 16:04:04' zj-frontend01-error.2016-09-26 
 2016/09/26 16:04:04 [error] 23060#0: *1325 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.171.246.184, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn", referrer: "https://www.zjcap.cn/wechat/home.html?useragent=android_h5_zjcap&apiver=2"

 [root@dr-mysql01 zjzc_log]# grep '2016/09/26 16:04:04' zj-frontend01-error.2016-09-26 
 2016/09/26 16:04:04 [error] 23060#0: *1325 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.171.246.184, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn", referrer: "https://www.zjcap.cn/wechat/home.html?useragent=android_h5_zjcap&apiver=2"
 2016/09/26 16:04:04 [error] 23060#0: *1325 open() "/var/www/zjzc-web-frontEnd/favicon.ico" failed (2: No such file or directory), client: 10.171.246.184, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "www.zjcap.cn", referrer: "https://www.zjcap.cn/wechat/home.html?useragent=android_h5_zjcap&apiver=2"
 
 
 此时之前的日志也会同步一份


 
 

你可能感兴趣的:(rsyslog)