{"id":63729,"date":"2025-04-29T10:19:18","date_gmt":"2025-04-29T02:19:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63729\/"},"modified":"2025-04-29T10:19:18","modified_gmt":"2025-04-29T02:19:18","slug":"linux%e6%80%8e%e4%b9%88%e7%9c%8blog%e6%97%a5%e5%bf%97-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63729\/","title":{"rendered":"linux\u600e\u4e48\u770blog\u65e5\u5fd7"},"content":{"rendered":"<blockquote><p>\n  \u67e5\u770b linux \u65e5\u5fd7\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u547d\u4ee4\u884c\u5de5\u5177\uff1ajournalctl\u3001dmesg\u3001tail\u56fe\u5f62\u5316\u5de5\u5177\uff1agnome \u65e5\u5fd7\u67e5\u770b\u5668\u3001ksystemlog\u3001logwatch\u7279\u5b9a\u65e5\u5fd7\u6587\u4ef6\uff1a\/var\/log\/syslog\u3001\/var\/log\/auth.log\u3001\/var\/log\/kern.log\u3001\/var\/log\/messages\u8fc7\u6ee4\u548c\u641c\u7d22\u65e5\u5fd7\u6d88\u606f\uff1ajournalctl &#8211;since\u3001journalctl -u\u3001journalctl -g\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/04\/2024060414272164995.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u770blog\u65e5\u5fd7\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u770blog\u65e5\u5fd7\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Linux \u65e5\u5fd7<\/strong><\/p>\n<p>\u67e5\u770b Linux \u65e5\u5fd7\u662f\u4e86\u89e3\u7cfb\u7edf\u6d3b\u52a8\u3001\u8bca\u65ad\u95ee\u9898\u548c\u786e\u4fdd\u7cfb\u7edf\u6b63\u5e38\u8fd0\u884c\u7684\u91cd\u8981\u4efb\u52a1\u3002Linux \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u67e5\u770b\u65e5\u5fd7\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u53d1\u884c\u7248\u548c\u65e5\u5fd7\u7c7b\u578b\u3002<\/p>\n<p><strong>\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177<\/strong><\/p>\n<ul>\n<li>\n<p><strong>journalctl<\/strong>\uff1a\u8fd9\u662f Systemd \u65e5\u5fd7\u7ba1\u7406\u5668\u7684\u4e3b\u8981\u547d\u4ee4\u884c\u5de5\u5177\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u3001\u8fc7\u6ee4\u548c\u641c\u7d22\u65e5\u5fd7\u6d88\u606f\uff1a<\/p>\n<pre>journalctl\njournalctl -u &lt;\u5355\u5143\u540d&gt;\njournalctl -f<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>dmesg<\/strong>\uff1a\u6b64\u547d\u4ee4\u663e\u793a\u5185\u6838\u73af\u5f62\u7f13\u51b2\u533a\u4e2d\u7684\u6d88\u606f\u3002\u5b83\u901a\u5e38\u7528\u4e8e\u67e5\u770b\u5f15\u5bfc\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef\u548c\u8b66\u544a\uff1a<\/p>\n<pre>dmesg<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>tail<\/strong>\uff1a\u6b64\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u6587\u4ef6\u7684\u672b\u5c3e\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u5b9e\u65f6\u65e5\u5fd7\u6587\u4ef6\uff1a<\/p>\n<pre>tail -f \/var\/log\/syslog<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>\u4f7f\u7528\u56fe\u5f62\u5316\u5de5\u5177<\/strong><\/p>\n<p>\u8bb8\u591a Linux \u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u4e86\u56fe\u5f62\u5316\u5de5\u5177\u6765\u67e5\u770b\u65e5\u5fd7\u3002\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li> <strong>Gnome \u65e5\u5fd7\u67e5\u770b\u5668<\/strong>\uff1a\u8fd9\u662f Gnome \u684c\u9762\u73af\u5883\u7684\u5185\u7f6e\u65e5\u5fd7\u67e5\u770b\u5668\u3002<\/li>\n<li> <strong>KSystemLog<\/strong>\uff1a\u8fd9\u662f KDE Plasma \u684c\u9762\u7684\u5185\u7f6e\u65e5\u5fd7\u67e5\u770b\u5668\u3002<\/li>\n<li> <strong>Logwatch<\/strong>\uff1a\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u5206\u6790\u548c\u663e\u793a\u7cfb\u7edf\u65e5\u5fd7\u7684\u547d\u4ee4\u884c\u548c\u56fe\u5f62\u5316\u5de5\u5177\u3002\u5b83\u63d0\u4f9b\u4e86\u6613\u4e8e\u9605\u8bfb\u7684\u65e5\u5fd7\u6c47\u603b\u3002<\/li>\n<\/ul>\n<p><strong>\u67e5\u770b\u7279\u5b9a\u65e5\u5fd7\u6587\u4ef6<\/strong><\/p>\n<p>Linux \u65e5\u5fd7\u901a\u5e38\u5b58\u50a8\u5728 \/var\/log \u76ee\u5f55\u4e2d\u3002\u4e00\u4e9b\u5e38\u89c1\u7684\u65e5\u5fd7\u6587\u4ef6\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\/var\/log\/syslog\uff1a\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5305\u542b\u6240\u6709\u5e94\u7528\u7a0b\u5e8f\u548c\u7cfb\u7edf\u7ec4\u4ef6\u7684\u6d88\u606f\u3002<\/li>\n<li>\/var\/log\/auth.log\uff1a\u6388\u6743\u65e5\u5fd7\uff0c\u5305\u542b\u4e0e\u7528\u6237\u8ba4\u8bc1\u548c\u8bbf\u95ee\u63a7\u5236\u76f8\u5173\u7684\u6d88\u606f\u3002<\/li>\n<li>\/var\/log\/kern.log\uff1a\u5185\u6838\u65e5\u5fd7\uff0c\u5305\u542b\u4e0e\u5185\u6838\u76f8\u5173\u7684\u9519\u8bef\u548c\u8b66\u544a\u3002<\/li>\n<li>\/var\/log\/messages\uff1a\u4e00\u4e2a\u901a\u7528\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ef\u80fd\u5305\u542b\u6765\u81ea\u4e0d\u540c\u6765\u6e90\u7684\u6d88\u606f\u3002<\/li>\n<\/ul>\n<p><strong>\u8fc7\u6ee4\u548c\u641c\u7d22\u65e5\u5fd7\u6d88\u606f<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u8fc7\u6ee4\u5668\u548c\u641c\u7d22\u9009\u9879\u6765\u67e5\u627e\u7279\u5b9a\u65e5\u5fd7\u6d88\u606f\u3002\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u8fc7\u6ee4\u65e5\u671f<\/strong>\uff1a<\/p>\n<pre>journalctl --since \"2023-02-01\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u8fc7\u6ee4\u8fdb\u7a0b<\/strong>\uff1a<\/p>\n<pre>journalctl -u &lt;\u8fdb\u7a0b\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u641c\u7d22\u7279\u5b9a\u6587\u672c<\/strong>\uff1a<\/p>\n<pre>journalctl -g &lt;\u641c\u7d22\u5b57\u7b26\u4e32&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u770blog\u65e5\u5fd7\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b linux \u65e5\u5fd7\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u547d\u4ee4\u884c\u5de5\u5177\uff1ajournalctl\u3001dmesg\u3001tail\u56fe\u5f62\u5316\u5de5\u5177\uff1agnome \u65e5\u5fd7\u67e5\u770b\u5668\u3001ksystemlog\u3001logwatch\u7279\u5b9a\u65e5\u5fd7\u6587\u4ef6\uff1a\/var\/log\/syslog\u3001\/var\/log\/auth.log\u3001\/var\/log\/kern.log\u3001\/var\/log\/messages\u8fc7\u6ee4\u548c\u641c\u7d22\u65e5\u5fd7\u6d88\u606f\uff1ajournalctl &#8211;since\u3001journalctl -u\u3001journalctl -g \u5982\u4f55\u67e5\u770b Linux \u65e5\u5fd7 \u67e5\u770b Linux \u65e5\u5fd7\u662f\u4e86\u89e3\u7cfb\u7edf\u6d3b\u52a8\u3001\u8bca\u65ad\u95ee\u9898\u548c\u786e\u4fdd\u7cfb\u7edf\u6b63\u5e38\u8fd0\u884c\u7684\u91cd\u8981\u4efb\u52a1\u3002Linux \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u67e5\u770b\u65e5\u5fd7\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u53d1\u884c\u7248\u548c\u65e5\u5fd7\u7c7b\u578b\u3002 \u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177 journalctl\uff1a\u8fd9\u662f Systemd \u65e5\u5fd7\u7ba1\u7406\u5668\u7684\u4e3b\u8981\u547d\u4ee4\u884c\u5de5\u5177\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u3001\u8fc7\u6ee4\u548c\u641c\u7d22\u65e5\u5fd7\u6d88\u606f\uff1a journalctl journalctl -u &lt;\u5355\u5143\u540d&gt; journalctl -f \u767b\u5f55\u540e\u590d\u5236 dmesg\uff1a\u6b64\u547d\u4ee4\u663e\u793a\u5185\u6838\u73af\u5f62\u7f13\u51b2\u533a\u4e2d\u7684\u6d88\u606f\u3002\u5b83\u901a\u5e38\u7528\u4e8e\u67e5\u770b\u5f15\u5bfc\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef\u548c\u8b66\u544a\uff1a dmesg \u767b\u5f55\u540e\u590d\u5236 tail\uff1a\u6b64\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u6587\u4ef6\u7684\u672b\u5c3e\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u67e5\u770b\u5b9e\u65f6\u65e5\u5fd7\u6587\u4ef6\uff1a tail -f \/var\/log\/syslog \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528\u56fe\u5f62\u5316\u5de5\u5177 \u8bb8\u591a Linux \u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u4e86\u56fe\u5f62\u5316\u5de5\u5177\u6765\u67e5\u770b\u65e5\u5fd7\u3002\u4f8b\u5982\uff1a Gnome \u65e5\u5fd7\u67e5\u770b\u5668\uff1a\u8fd9\u662f Gnome \u684c\u9762\u73af\u5883\u7684\u5185\u7f6e\u65e5\u5fd7\u67e5\u770b\u5668\u3002 KSystemLog\uff1a\u8fd9\u662f KDE Plasma \u684c\u9762\u7684\u5185\u7f6e\u65e5\u5fd7\u67e5\u770b\u5668\u3002 Logwatch\uff1a\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u5206\u6790\u548c\u663e\u793a\u7cfb\u7edf\u65e5\u5fd7\u7684\u547d\u4ee4\u884c\u548c\u56fe\u5f62\u5316\u5de5\u5177\u3002\u5b83\u63d0\u4f9b\u4e86\u6613\u4e8e\u9605\u8bfb\u7684\u65e5\u5fd7\u6c47\u603b\u3002 \u67e5\u770b\u7279\u5b9a\u65e5\u5fd7\u6587\u4ef6 Linux \u65e5\u5fd7\u901a\u5e38\u5b58\u50a8\u5728 \/var\/log \u76ee\u5f55\u4e2d\u3002\u4e00\u4e9b\u5e38\u89c1\u7684\u65e5\u5fd7\u6587\u4ef6\u5305\u62ec\uff1a \/var\/log\/syslog\uff1a\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5305\u542b\u6240\u6709\u5e94\u7528\u7a0b\u5e8f\u548c\u7cfb\u7edf\u7ec4\u4ef6\u7684\u6d88\u606f\u3002 \/var\/log\/auth.log\uff1a\u6388\u6743\u65e5\u5fd7\uff0c\u5305\u542b\u4e0e\u7528\u6237\u8ba4\u8bc1\u548c\u8bbf\u95ee\u63a7\u5236\u76f8\u5173\u7684\u6d88\u606f\u3002 \/var\/log\/kern.log\uff1a\u5185\u6838\u65e5\u5fd7\uff0c\u5305\u542b\u4e0e\u5185\u6838\u76f8\u5173\u7684\u9519\u8bef\u548c\u8b66\u544a\u3002 \/var\/log\/messages\uff1a\u4e00\u4e2a\u901a\u7528\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ef\u80fd\u5305\u542b\u6765\u81ea\u4e0d\u540c\u6765\u6e90\u7684\u6d88\u606f\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63729","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63729"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63729\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}