聆听日记更改


18

通常tail -f /var/log/messages,如果有新行,我会使用更新。

如何具有类似的功能journalctl

Answers:


26

您可以使用-f--follow开关尾随日志。

-f, --follow
    Show only the most recent journal entries, and continuously print new 
    entries as they are appended to the journal.

$ sudo journalctl -f
-- Logs begin at Sat 2013-12-07 21:11:30 EST. --
May 14 18:16:34 somehost.somedom.com systemd[1]: Starting Fingerprint Authentication Daemon...
May 14 18:16:34 somehost.somedom.com systemd[1]: Started Fingerprint Authentication Daemon.
May 14 18:16:34 somehost.somedom.com fprintd[12553]: Launching FprintObject
May 14 18:16:34 somehost.somedom.com fprintd[12553]: ** Message: D-Bus service launched with name: net.reactivated.Fprint
May 14 18:16:34 somehost.somedom.com fprintd[12553]: ** Message: entering main loop
May 14 18:16:37 somehost.somedom.com sudo[12552]: saml : TTY=pts/2 ; PWD=/home/saml ; USER=root ; COMMAND=/bin/journalctl -f
May 14 18:16:40 somehost.somedom.com gnome-session[1787]: 18:16:40 | Listener | Trying to reconnect to tcp://notifications.sparkleshare.org:443/
May 14 18:16:44 somehost.somedom.com sudo[12582]: saml : TTY=pts/2 ; PWD=/home/saml ; USER=root ; COMMAND=/bin/journalctl -f -n 10
May 14 18:16:45 somehost.somedom.com gnome-session[1787]: 18:16:45 | Listener | Disconnected from tcp://notifications.sparkleshare.org:443/: ...d block
May 14 18:16:45 somehost.somedom.com gnome-session[1787]: 18:16:45 | personal_repo | Falling back to regular polling
May 14 18:17:04 somehost.somedom.com fprintd[12553]: ** Message: No devices in use, exit

参考文献


2
似乎禁用了寻呼机,想同时使用这两种寻呼机
Ben Creasy

1
@Ben Creasy $ journalctl -f-从昨天开始,$ journalctl -f -n 1000
EngineerX

1
journalctl --follow --no-tail --no-tail当您想要所有以前的行(大于-n 100000或任意大行数)时使用
Olivier LAHAYE
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.