{"id":46094,"date":"2023-04-19T09:44:38","date_gmt":"2023-04-19T01:44:38","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=46094"},"modified":"2023-04-19T09:44:38","modified_gmt":"2023-04-19T01:44:38","slug":"linux-sys-log","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-sys-log.html","title":{"rendered":"\u5728 Linux \u4e0a\u914d\u7f6e\u4e00\u4e2a syslog \u670d\u52a1\u5668"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Syslog\u670d\u52a1\u5668\u53ef\u4ee5\u7528\u4f5c\u4e00\u4e2a\u7f51\u7edc\u4e2d\u7684\u65e5\u5fd7\u76d1\u63a7\u4e2d\u5fc3\uff0c\u6240\u6709\u80fd\u591f\u901a\u8fc7\u7f51\u7edc\u6765\u53d1\u9001\u65e5\u5fd7\u7684\u8bbe\u65bd\uff08\u5305\u542b\u4e86Linux\u6216Windows\u670d\u52a1\u5668\uff0c\u8def\u7531\u5668\uff0c\u4ea4\u6362\u673a\u4ee5\u53ca\u5176\u4ed6\u4e3b\u673a\uff09\u90fd\u53ef\u4ee5\u628a\u65e5\u5fd7\u53d1\u9001\u7ed9\u5b83\u3002 \u901a\u8fc7\u8bbe\u7f6e\u4e00\u4e2asyslog\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u5c06\u4e0d\u540c\u8bbe\u65bd\/\u4e3b\u673a\u53d1\u9001\u7684\u65e5\u5fd7\uff0c\u8fc7\u6ee4\u548c\u5408\u5e76\u5230\u4e00\u4e2a\u72ec\u7acb\u7684\u4f4d\u7f6e\uff0c\u8fd9\u6837\u4f7f\u5f97\u4f60\u66f4\u5bb9\u6613\u5730\u67e5\u770b\u548c\u83b7\u53d6\u91cd\u8981\u7684\u65e5\u5fd7\u6d88\u606f\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Rsyslog \u4f5c\u4e3a\u6807\u51c6\u7684syslog\u5b88\u62a4\u8fdb\u7a0b\uff0c\u9884\u88c5\u5728\u4e86\u5927\u591a\u6570\u7684Linux\u53d1\u884c\u7248\u4e2d\u3002\u5728\u5ba2\u6237\u7aef\/\u670d\u52a1\u5668\u67b6\u6784\u7684\u914d\u7f6e\u4e0b\uff0crsyslog\u540c\u65f6\u626e\u6f14\u4e86\u4e24\u79cd\u89d2\u8272\uff1a1.\u4f5c\u4e3a\u4e00\u4e2asyslog\u670d\u52a1\u5668\uff0crsyslog\u53ef\u4ee5\u6536\u96c6\u6765\u81ea\u5176\u4ed6\u8bbe\u65bd\u7684\u65e5\u5fd7\u4fe1\u606f\uff1b2.\u4f5c\u4e3a\u4e00\u4e2asyslog\u5ba2\u6237\u7aef\uff0crsyslog\u53ef\u4ee5\u5c06\u5176\u5185\u90e8\u7684\u65e5\u5fd7\u4fe1\u606f\u4f20\u8f93\u5230\u8fdc\u7a0b\u7684syslog\u670d\u52a1\u5668\u3002<\/p>\n \u5728\u6b64\uff0c\u6211\u4eec\u6f14\u793a\u4e86\u5728linux\u4e0a\u5982\u4f55\u901a\u8fc7rsyslog\u6765\u914d\u7f6e\u4e00\u4e2a\u4e2d\u5fc3\u5316syslog\u670d\u52a1\u5668\u3002 \u5728\u8fdb\u5165\u8be6\u89e3\u4e4b\u524d\uff0c\u5148\u6e29\u4e60\u4e00\u4e0bsyslog\u6807\u51c6\u3002\n<\/p>\n syslog\u6807\u51c6\u57fa\u7840<\/strong><\/div>\n \n\u5f53\u901a\u8fc7syslog\u673a\u5236\u6765\u6536\u96c6\u65e5\u5fd7\u65f6\uff0c\u67093\u4e2a\u5fc5\u987b\u8981\u8003\u8651\u5230\u7684\u91cd\u8981\u4e8b\u60c5\uff1a \u73b0\u5728\u6211\u4eec\u66f4\u52a0\u6df1\u5165\u5730\u4e86\u89e3\u4e00\u4e0b\u914d\u7f6e\u662f\u5982\u4f55\u5b9a\u4e49\u7684\u3002<\/p>\n \u8bbe\u65bd\u5c42\u7ea7\u5b9a\u4e49\u4e86\u4e00\u79cd\u7528\u6765\u5bf9\u5185\u90e8\u7cfb\u7edf\u8fdb\u7a0b\u8fdb\u884c\u5206\u7c7b\u7684\u65b9\u6cd5\uff0clinux\u4e2d\u7684\u4e00\u4e9b\u5e38\u89c1\u7684\u8bbe\u65bd\u5305\u62ec: \u4e25\u91cd\u6027\uff08\u4f18\u5148\uff09\u7ea7\u522b\u6709\u56fa\u5b9a\u7684\u6807\u51c6\u7f29\u5199\u548c\u6307\u4ee3\u7684\u503c\uff0c\u5176\u4e2d\u7684\u6570\u5b577\u5177\u6709\u6700\u9ad8\u7684\u7ea7\u522b\uff0c\u8fd9\u4e9b\u7ea7\u522b\u5305\u542b\u4e86\uff1a \u6700\u540e\uff0c\u76ee\u6807\u8bed\u53e5\u4f1a\u8ba9\u4e00\u4e2asyslog\u5ba2\u6237\u7aef\u6765\u6267\u884c\u4ee5\u4e0b\u4e09\u4e2a\u4efb\u52a1\u4e4b\u4e00\uff1a \u5728 rsyslog\u91cc, syslog\u7684\u914d\u7f6e\u662f\u57fa\u4e8e\u4ee5\u4e0b\u6a21\u5f0f\u8fdb\u884c\u7ed3\u6784\u5316\u7684\u3002<\/p>\n \r\n1.[facility-level].[severity-level] [destination]\r\n\r\n<\/pre>\n |