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


    <pre name="code" class="html">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"
     
     
     此时之前的日志也会同步一份


    
                                        
    
  • 相关阅读:
    设计模式之美学习-接口隔离原则(七)
    设计模式之美学习-里式替换原则(六)
    设计模式之美学习-开闭原则(五)
    设计模式之美学习-设计原则之单一职责(四)
    设计模式之美学习-如何进行面向对象设计(三)
    ffmpeg 从内存中读取数据(或将数据输出到内存)
    CImage 对话框初始化时候显示透明 PNG
    RTMPdump(libRTMP) 源代码分析 9: 接收消息(Message)(接收视音频数据)
    RTMPdump(libRTMP) 源代码分析 8: 发送消息(Message)
    RTMPdump(libRTMP) 源代码分析 7: 建立一个流媒体连接 (NetStream部分 2)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350214.html
Copyright © 2020-2023  润新知