{"id":265396,"date":"2023-02-24T22:05:55","date_gmt":"2023-02-24T14:05:55","guid":{"rendered":"https:\/\/lrxjmw.cn\/lxtnhhxtyxcw.html"},"modified":"2023-02-24T22:05:55","modified_gmt":"2023-02-24T14:05:55","slug":"lxtnhhxtyxcw","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lxtnhhxtyxcw.html","title":{"rendered":"Linux\u7cfb\u7edf\u5185\u6838\u548c\u7cfb\u7edf\u8fd0\u884c\u9519\u8bef\u65f6\u5feb\u901f\u5b9a\u4f4d\u9519\u8bef\u4f4d\u7f6e\u7684\u9014\u5f84"},"content":{"rendered":"
\u65e5\u5fd7\u7cfb\u7edf<\/a>\u5c06\u6211\u4eec\u7cfb\u7edf\u8fd0\u884c\u7684\u6bcf\u4e00\u4e2a\u72b6\u51b5\u4fe1\u606f\u90fd\u4f7f\u7528\u6587\u5b57\u8bb0\u5f55\u51fa\u6765\uff0c\u8fd9\u79cd\u4fe1\u606f\u6709\u52a9\u6211\u4eec\u89c2\u5bdf\u7cfb\u7edf\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u6b63\u5e38\u72b6\u6001\u548c\u7cfb\u7edf\u8fd0\u884c\u9519\u8bef\u65f6\u5feb\u901f\u5b9a\u4f4d\u9519\u8bef\u4f4d\u7f6e\u7684\u9014\u5f84\u7b49;\u4e0b\u8fb9\u5b66\u4e60\u5566\u5c0f\u7f16\u4e3b\u8981\u6982\u8ff0\u4e00\u4e0bLinux<\/a>\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u3002<\/p>\n Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u89e3\u8bfb<\/p>\n \u5927\u90e8\u4efdLinux\u53d1\u884c\u7248\u9ed8\u8ba4\u7684\u65e5\u5fd7\u5b88\u62a4\u8fdb\u7a0b\u4e3asyslog\uff0c\u5750\u843d\/etc\/syslog\u6216\/etc\/syslogd\uff0c\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u4e3a\/etc\/syslog.conf\uff0c\u4efb\u4f55\u5e0c\u671b\u751f\u6210\u65e5\u5fd7\u7684\u7a0b\u5e8f\u90fd\u53ef\u4ee5\u5411syslog\u53d1\u9001\u4fe1\u606f\u3002<\/p>\n Linux\u7cfb\u7edf\u5185\u6838\u548c\u8bb8\u591a\u7a0b\u5e8f\u4f1a\u5f62\u6210\u5404\u7c7b\u9519\u8bef\u4fe1\u606f\u3001\u8b66\u544a\u4fe1\u606f\u548c\u5176\u4ed6\u7684\u63d0\u793a\u4fe1\u606f\uff0c\u8fd9\u79cd\u4fe1\u606f\u5bf9\u7ba1\u7406\u5458\u4e86\u89e3\u7cfb\u7edf\u7684\u8fd0\u884c\u72b6\u6001\u662f\u5341\u5206\u6709\u7528\u7684linux\u8fd0\u7ef4\u535a\u5ba2\uff0c\u6240\u4ee5\u5e94\u5f53\u628a\u5b83\u4eec\u8bb2\u5230\u65e5\u5fd7\u6587\u4ef6\u4e2d\u53bb\u3002\u5b8c\u6210\u8fd9\u4e2a\u8fc7\u7a0b\u7684\u7a0b\u5e8f\u5c31\u662fsyslog\u3002syslog\u53ef\u4ee5\u6309\u7167\u65e5\u5fd7\u7684\u7c7b\u522b\u548c\u4f18\u5148\u7ea7\u5c06\u65e5\u5fd7\u4fdd\u5b58\u5230\u4e0d\u540c\u7684\u6587\u4ef6\u4e2d\u3002\u8bf8\u5982\uff0c\u4e3a\u4e86\u4fbf\u6377\u67e5\u9605\uff0c\u53ef\u4ee5\u628a\u5185\u6838\u4fe1\u606f\u4e0e\u5176\u4ed6\u4fe1\u606f\u5206\u5f00\uff0c\u5355\u72ec\u4fdd\u5b58\u5230\u4e00\u4e2a\u72ec\u7acb\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002\u9ed8\u8ba4\u914d\u7f6e\u4e0b\uff0c\u65e5\u5fd7\u6587\u4ef6\u4e00\u822c\u90fd\u4fdd\u5b58\u5728\u201c\/var\/log\u201d\u76ee\u5f55\u4e0b\u3002<\/p>\n \u65e5\u5fd7\u7c7b\u578b<\/p>\n \u4e0b\u8fb9\u662f\u5e38\u89c1\u7684\u65e5\u5fd7\u7c7b\u578b\uff0c\u4f46\u5e76\u4e0d\u662f\u6240\u6709\u7684Linux\u53d1\u884c\u7248\u90fd\u5305\u542b\u90a3\u4e9b\u7c7b\u578b\uff1a<\/p>\n \u65e5\u5fd7\u4f18\u5148\u7ea7<\/p>\n \u5e38\u89c1\u7684\u65e5\u5fd7\u4f18\u5148\u7ea7\u8bf7\u89c1\u4e0b\u6807\uff1a<\/p>\n \u4f18\u5148\u7ea7\u8bf4\u660e<\/p>\n emerg<\/p>\n \u7d27\u6025\u60c5\u51b5\uff0c\u7cfb\u7edf\u4e0d\u53ef\u7528\uff08\u6bd4\u5982\u7cfb\u7edf\u5d29\u6e83\uff09\uff0c\u901a\u5e38\u4f1a\u901a\u77e5\u6240\u6709\u7528\u6237\u3002<\/p>\n alert<\/p>\n \u987b\u8981\u7acb\u523b\u4fee\u8865\uff0c\u6bd4\u5982\u7cfb\u7edf\u6570\u636e\u5e93\u53d7\u635f\u3002<\/p>\n crit<\/p>\n \u5371\u9669\u60c5\u51b5\uff0c\u6bd4\u5982\u786c\u789f\u9519\u8bef\uff0c\u53ef\u80fd\u4f1a\u59a8\u788d\u7a0b\u5e8f\u7684\u90e8\u4efd\u529f\u80fd\u3002<\/p>\n err<\/p>\n \u901a\u5e38\u9519\u8bef\u6d88\u606f\u3002<\/p>\n warning<\/p>\n \u8b66\u544a\u3002<\/p>\n <\/p>\n notice<\/p>\n \u4e0d\u662f\u9519\u8bef\uff0c\u5e76\u4e14\u53ef\u80fd\u987b\u8981\u5904\u7406\u3002<\/p>\n info<\/p>\n \u901a\u7528\u6027\u6d88\u606f\uff0c\u901a\u5e38\u62ff\u6765\u63d0\u4f9b\u6709\u7528\u4fe1\u606f\u3002<\/p>\n debug<\/p>\n \u8c03\u8bd5\u7a0b\u5e8f\u5f62\u6210\u7684\u4fe1\u606f\u3002<\/p>\n none<\/p>\n \u6ca1\u6709\u4f18\u5148\u7ea7\uff0c\u4e0d\u8bb0\u5f55\u4efb\u4f55\u65e5\u5fd7\u6d88\u606f\u3002<\/p>\n \u5e38\u89c1\u65e5\u5fd7\u6587\u4ef6<\/p>\n \u6240\u6709\u7684\u7cfb\u7edf\u5e94\u7528\u5c31\u4f1a\u5728\/var\/log\u76ee\u5f55\u4e0b\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\uff0c\u6216\u521b\u5efa\u5b50\u76ee\u5f55\u518d\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u3002\u8bf8\u5982\uff1a<\/p>\n \/etc\/syslog.conf\u6587\u4ef6<\/p>\n \/etc\/syslog.conf\u662fsyslog\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f1a\u4f9d\u7167\u65e5\u5fd7\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u6765\u51b3\u5b9a\u5c06\u65e5\u5fd7\u4fdd\u5b58\u5230\u4f55\u5904\u3002\u5178\u578b\u7684syslog.conf\u6587\u4ef6\u683c\u5f0f\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n *.err;kern.debug;auth.notice\/dev\/console<\/p>\n daemon,auth.notice\/var\/log\/messages<\/p>\n \/var\/log\/lpr.log<\/p>\n mail.*\/var\/log\/mail.log<\/p>\n ftp.*\/var\/log\/ftp.log<\/p>\n auth.*@<\/p>\n auth.*root,amrood<\/p>\n netinfo.err\/var\/log\/netinfo.log<\/p>\n install.*\/var\/log\/install.log<\/p>\n *.emerg*<\/p>\n *.alert|program_name<\/p>\n mark.*\/dev\/console<\/p>\n \u7b2c\u4e00\u5217\u4e3a\u65e5\u5fd7\u7c7b\u578b\u548c\u65e5\u5fd7\u4f18\u5148\u7ea7\u7684\u7ec4\u5408\uff0c\u6bcf\u4f4d\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u7684\u7ec4\u79f0\u4f5c\u4e3a\u4e00\u4e2a\u9009\u62e9\u5668;\u524d\u9762\u4e00\u5217\u4e3a\u4fdd\u5b58\u65e5\u5fd7\u7684\u6587\u4ef6\u3001\u670d\u52a1\u5668\uff0c\u6216\u8f93\u51fa\u65e5\u5fd7\u7684\u7ec8\u7aef\u3002syslog\u8fdb\u7a0b\u4f9d\u636e\u9009\u62e9\u5668\u51b3\u5b9a\u600e\u6837\u64cd\u4f5c\u65e5\u5fd7\u3002<\/p>\n \u5bf9\u914d\u7f6e\u6587\u4ef6\u7684\u51e0\u70b9\u8bf4\u660e\uff1a<\/p>\n \u65e5\u5fd7\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u7531\u70b9\u53f7(.)\u5206\u5f00\uff0c\u6bd4\u5982kern.debug\u8868\u793a\u7531\u5185\u6838\u5f62\u6210\u7684\u8c03\u8bd5\u4fe1\u606f\u3002<\/p>\n kern.debug\u7684\u4f18\u5148\u7ea7\u5c0f\u4e8edebug\u3002<\/p>\n \u661f\u53f7(*)\u8868\u793a\u6240\u6709\uff0c\u6bd4\u5982*.debug\u8868\u793a\u6240\u6709\u7c7b\u578b\u7684\u8c03\u8bd5\u4fe1\u606f\uff0ckern.*\u8868\u793a\u7531\u5185\u6838\u5f62\u6210\u7684\u6240\u6709\u6d88\u606f\u3002<\/p>\n \u53ef\u4ee5\u4f7f\u7528\u5192\u53f7(,)\u5206\u9694\u591a\u4e2a\u65e5\u5fd7\u7c7b\u578b\uff0c\u4f7f\u7528\u5206\u53f7(;)\u5206\u9694\u591a\u4e2a\u9009\u62e9\u5668\u3002<\/p>\n \u5bf9\u65e5\u5fd7\u7684\u64cd\u4f5c\u5305\u62ec\uff1a<\/p>\n \u5c06\u65e5\u5fd7\u8f93\u51fa\u5230\u6587\u4ef6\uff0c\u6bd4\u5982\/var\/log\/maillog\u6216\/dev\/console\u3002<\/p>\n