{"id":5524,"date":"2019-11-24T14:16:28","date_gmt":"2019-11-24T06:16:28","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=5524"},"modified":"2022-05-28T14:16:03","modified_gmt":"2022-05-28T06:16:03","slug":"journalctl","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/journalctl","title":{"rendered":"journalctl\u547d\u4ee4 – \u67e5\u770b\u6307\u5b9a\u7684\u65e5\u5fd7\u4fe1\u606f"},"content":{"rendered":"\n

journalctl\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cjournal control\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u67e5\u770b\u6307\u5b9a\u7684\u65e5\u5fd7\u4fe1\u606f\u3002\u5728RHEL7\/CentOS7\u53ca\u4ee5\u540e\u7248\u672c\u7684Linux\u7cfb\u7edf\u4e2d\uff0cSystemd\u670d\u52a1\u7edf\u4e00\u7ba1\u7406\u4e86\u6240\u6709\u670d\u52a1\u7684\u542f\u52a8\u65e5\u5fd7\uff0c\u5e26\u6765\u7684\u597d\u5904\u5c31\u662f\u53ef\u4ee5\u53ea\u7528journalctl\u4e00\u4e2a\u547d\u4ee4\uff0c\u67e5\u770b\u5230\u5168\u90e8\u7684\u65e5\u5fd7\u4fe1\u606f\u4e86\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

-k<\/td>\u67e5\u770b\u5185\u6838\u65e5\u5fd7<\/td><\/tr>
-b<\/td>\u67e5\u770b\u7cfb\u7edf\u672c\u6b21\u542f\u52a8\u7684\u65e5\u5fd7<\/td><\/tr>
-u<\/td>\u67e5\u770b\u6307\u5b9a\u670d\u52a1\u7684\u65e5\u5fd7<\/td><\/tr>
-n<\/td>\u6307\u5b9a\u65e5\u5fd7\u6761\u6570<\/td><\/tr>
-f<\/td>\u8ffd\u8e2a\u65e5\u5fd7<\/td><\/tr>
--disk-usage<\/td>\u67e5\u770b\u5f53\u524d\u65e5\u5fd7\u5360\u7528\u78c1\u76d8\u7684\u7a7a\u95f4\u7684\u603b\u5927\u5c0f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

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

\u67e5\u770b\u7cfb\u7edf\u4e2d\u5168\u90e8\u7684\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl <\/strong>\n-- Logs begin at Thu 2022-05-19 02:12:18 CST, end at Sat 2022-05-28 13:15:02 CS>\nMay 19 02:12:18 linuxprobe.com kernel: Linux version 4.18.0-80.el8.x86_64 (mock>\nMay 19 02:12:18 linuxprobe.com kernel: Command line: BOOT_IMAGE=(hd0,msdos1)\/vm>\nMay 19 02:12:18 linuxprobe.com kernel: Disabled fast string operations\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u6307\u5b9a\u67e5\u770b\u5185\u6838\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -k<\/strong>\n-- Logs begin at Thu 2022-05-19 02:12:18 CST, end at Sat 2022-05-28 13:15:02 CS>\nMay 19 02:12:18 linuxprobe.com kernel: Linux version 4.18.0-80.el8.x86_64 (mock>\nMay 19 02:12:18 linuxprobe.com kernel: Command line: BOOT_IMAGE=(hd0,msdos1)\/vm>\nMay 19 02:12:18 linuxprobe.com kernel: Disabled fast string operations\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u6307\u5b9a\u67e5\u770b\u672c\u6b21\u7cfb\u7edf\u542f\u52a8\u7684\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -b<\/strong>\n-- Logs begin at Thu 2022-05-19 02:12:18 CST, end at Sat 2022-05-28 13:15:02 CS>\nMay 19 02:12:18 linuxprobe.com kernel: x86\/fpu: Supporting XSAVE feature 0x001:>\nMay 19 02:12:18 linuxprobe.com kernel: x86\/fpu: Supporting XSAVE feature 0x002:>\nMay 19 02:12:18 linuxprobe.com kernel: x86\/fpu: Supporting XSAVE feature 0x004:>\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u6307\u5b9a\u67e5\u770b\u67d0\u4e2a\u670d\u52a1\u7a0b\u5e8f\u7684\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -u sshd<\/strong>\r\n-- Logs begin at Thu 2022-05-19 02:12:18 CST, end at Sat 2022-05-28 13:17:01 CS>\r\nMay 19 02:12:22 linuxcool.com systemd[1]: Starting OpenSSH server daemon...\r\nMay 19 02:12:22 linuxcool.com sshd[1109]: Server listening on 0.0.0.0 port 22.\r\nMay 19 02:12:22 linuxcool.com sshd[1109]: Server listening on :: port 22.\r\nMay 19 02:12:22 linuxcool.com systemd[1]: Started OpenSSH server daemon.\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u6307\u5b9a\u67e5\u770b\u6700\u8fd110\u6761\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -n 10<\/strong>\r\n-- Logs begin at Thu 2022-05-19 02:12:18 CST, end at Sat 2022-05-28 13:17:01 CS>\r\nMay 28 13:01:01 linuxcool.com run-parts[3541]: (\/etc\/cron.hourly) finished 0ana>\r\nMay 28 13:15:00 linuxcool.com dbus-daemon[980]: [system] Activating via systemd>\r\nMay 28 13:15:00 linuxcool.com systemd[1]: Starting Fingerprint Authentication D>\r\nMay 28 13:15:00 linuxcool.com dbus-daemon[980]: [system] Successfully activated>\r\nMay 28 13:15:00 linuxcool.com systemd[1]: Started Fingerprint Authentication Da>\r\nMay 28 13:15:02 linuxcool.com gdm-password][3666]: gkr-pam: unlocked login keyr>\r\nMay 28 13:15:02 linuxcool.com NetworkManager[1093]: <info>  [1653714902.2810] a>\r\nMay 28 13:17:01 linuxcool.com anacron[2921]: Job `cron.monthly' started\r\nMay 28 13:17:01 linuxcool.com anacron[2921]: Job `cron.monthly' terminated\r\nMay 28 13:17:01 linuxcool.com anacron[2921]: Normal exit (3 jobs run)\r<\/pre>\n\n\n\n

\u6301\u7eed\u8ffd\u8e2a\u6700\u65b0\u7684\u65e5\u5fd7\u4fe1\u606f\uff0c\u4fdd\u6301\u5237\u65b0\u5185\u5bb9\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# journalctl -f<\/strong>\n-- Logs begin at Thu 2022-05-19 02:12:18 CST. --\nMay 28 13:01:01 linuxcool.com run-parts[3541]: (\/etc\/cron.hourly) finished 0anacron\nMay 28 13:15:00 linuxcool.com dbus-daemon[980]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' requested by ':1.177' (uid=0 pid=2222 comm=\"\/usr\/bin\/gnome-shell \" label=\"unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023\")\nMay 28 13:15:00 linuxcool.com systemd[1]: Starting Fingerprint Authentication Daemon...\nMay 28 13:15:00 linuxcool.com dbus-daemon[980]: [system] Successfully activated service 'net.reactivated.Fprint'\nMay 28 13:15:00 linuxcool.com systemd[1]: Started Fingerprint Authentication Daemon.\nMay 28 13:15:02 linuxcool.com gdm-password][3666]: gkr-pam: unlocked login keyring\nMay 28 13:15:02 linuxcool.com NetworkManager[1093]: <info>  [1653714902.2810] agent-manager: req[0x7fdcc8007190, :1.177\/org.gnome.Shell.NetworkAgent\/0]: agent registered\nMay 28 13:17:01 linuxcool.com anacron[2921]: Job `cron.monthly' started\nMay 28 13:17:01 linuxcool.com anacron[2921]: Job `cron.monthly' terminated\nMay 28 13:17:01 linuxcool.com anacron[2921]: Normal exit (3 jobs run)\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n","protected":false},"excerpt":{"rendered":"

journalctl\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cjournal control\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u67e5\u770b\u6307\u5b9a\u7684\u65e5\u5fd7\u4fe1\u606f […]<\/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\/5524"}],"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=5524"}],"version-history":[{"count":13,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5524\/revisions"}],"predecessor-version":[{"id":10151,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5524\/revisions\/10151"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=5524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=5524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=5524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}