8

journalctl --boot prints log lines since boot and journalctl --follow prints the last 10 lines of the log and then follows it. But journalctl --boot --follow doesn't work like I expect it to. Rather than printing all the journal lines since boot and then following the journal it just ignores --boot flag. Swapping the flags around makes no difference. How do I print all the log lines since boot and then follow the log?

Version info:

$ journalctl --version
systemd 239
+PAM +AUDIT -SELINUX +IMA +APPARMOR +SMACK -SYSVINIT +UTMP -LIBCRYPTSETUP +GCRYPT -GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

2 Answers 2

8

Adding --lines=all does the trick - rather than overriding --boot they work together to follow lines since boot.

journalctl --boot --lines=all --follow
0
3

Adding --no-tail also does the trick.

$ journalctl --boot --follow --no-tail
May 22 21:36:53 <hostname> kernel: microcode: microcode updated early to revision ...
May 22 21:36:53 <hostname> kernel: Linux version 5.15.0-30-generic (buildd@lgw01-amd64-058) (gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022 (Ubuntu 5.15.0-30.31-generic 5.15.30)
...
May 23 15:17:43 <hostname> systemd[1]: Started Session 40 of User <username>.
^C
$ journalctl --version
systemd 249 (249.11-0ubuntu3.1)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS -OPENSSL +ACL +BLKID +CURL +ELFUTILS -FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP -LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy

The following are copied from man journalctl :

-n, --lines=

Show the most recent journal events and limit the number of events shown. If --follow is used, this option is implied. The argument is a positive integer or "all" to disable line limiting. The default value is 10 if no argument is given.

--no-tail

Show all stored output lines, even in follow mode. Undoes the effect of --lines=.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .