{"id":8031,"date":"2020-06-22T15:31:44","date_gmt":"2020-06-22T07:31:44","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8031"},"modified":"2020-08-28T12:58:39","modified_gmt":"2020-08-28T04:58:39","slug":"journalctl-2","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/journalctl-2","title":{"rendered":"[\u91cd]journalctl\u547d\u4ee4 – \u68c0\u7d22systemd\u65e5\u5fd7"},"content":{"rendered":"\n

journalctl\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u67e5\u8be2 systemd-journald.service(8) \u6240\u5199\u7684 systemd(1) \u65e5\u5fd7\u7684\u5185\u5bb9\u3002\u5982\u679c\u8c03\u7528\u65f6\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u4f1a\u663e\u793a\u65e5\u5fd7\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u4ece\u6536\u96c6\u5230\u7684\u6700\u65e9\u7684\u6761\u76ee\u5f00\u59cb\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>journalctl [\u53c2\u6570]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-a<\/td>\u5b8c\u6574\u663e\u793a\u6240\u6709\u5b57\u6bb5\u5185\u5bb9\uff0c\u5373\u4f7f\u5176\u4e2d\u5305\u542b\u975e\u6253\u5370\u5b57\u7b26\u6216\u8005\u5b57\u6bb5\u5185\u5bb9\u8d85\u957f<\/td><\/tr>
-f<\/td>\u53ea\u663e\u793a\u6700\u65b0\u7684\u65e5\u5fd7\u9879\uff0c \u5e76\u4e14\u4e0d\u65ad\u663e\u793a\u65b0\u751f\u6210\u7684\u65e5\u5fd7\u9879<\/td><\/tr>
-n<\/td>\u9650\u5236\u663e\u793a\u6700\u65b0\u7684\u65e5\u5fd7\u884c\u6570<\/td><\/tr>
-e<\/td>\u5728\u5206\u9875\u5de5\u5177\u5185 \u7acb\u5373\u8df3\u8f6c\u5230\u65e5\u5fd7\u7684\u5c3e\u90e8<\/td><\/tr>
-o<\/td>\u63a7\u5236\u65e5\u5fd7\u7684 \u8f93\u51fa\u683c\u5f0f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u4e0d\u5e26\u4efb\u4f55\u9009\u9879\u4e0e\u53c2\u6570\uff0c \u8868\u793a\u663e\u793a\u5168\u90e8\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl<\/pre>\n\n\n\n

\u4ec5\u6307\u5b9a\u4e00\u4e2a\u5339\u914d\u6761\u4ef6\uff0c \u663e\u793a\u6240\u6709\u7b26\u5408\u8be5\u5339\u914d\u6761\u4ef6\u7684\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl _SYSTEMD_UNIT=avahi-daemon.service<\/pre>\n\n\n\n

\u6307\u5b9a\u4e86\u4e24\u4e2a\u4e0d\u540c\u5b57\u6bb5\u7684\u5339\u914d\u6761\u4ef6\uff0c \u663e\u793a\u540c\u65f6\u6ee1\u8db3\u4e24\u4e2a\u5339\u914d\u6761\u4ef6\u7684\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097<\/pre>\n\n\n\n

\u6307\u5b9a\u4e86\u540c\u4e00\u4e2a\u5b57\u6bb5\u7684\u4e24\u4e2a\u4e0d\u540c\u5339\u914d\u6761\u4ef6\uff0c \u663e\u793a\u6ee1\u8db3\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6761\u4ef6\u7684\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service<\/pre>\n\n\n\n

\u4f7f\u7528 “+” \u8fde\u63a5 \u4e24\u7ec4\u5339\u914d\u6761\u4ef6\uff0c \u76f8\u5f53\u4e8e \u903b\u8f91”OR”\u8fde\u63a5\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service<\/pre>\n\n\n\n

\u663e\u793a\u6240\u6709 D-Bus \u8fdb\u7a0b\u4ea7\u751f\u7684\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl \/usr\/bin\/dbus-daemon<\/pre>\n\n\n\n

\u663e\u793a\u4e0a\u4e00\u6b21\u542f\u52a8\u6240\u4ea7\u751f\u7684\u6240\u6709\u5185\u6838\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -k -b -1<\/pre>\n\n\n\n

\u6301\u7eed\u663e\u793a apache.service \u670d\u52a1\u4e0d\u65ad\u751f\u6210\u7684\u65e5\u5fd7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -f -u apache<\/pre>\n","protected":false},"excerpt":{"rendered":"

journalctl\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u67e5\u8be2 systemd-journald.service(8) \u6240\u5199\u7684 syst […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8031"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8031"}],"version-history":[{"count":7,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8031\/revisions"}],"predecessor-version":[{"id":8097,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8031\/revisions\/8097"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}