journalctl: New option --cursor-file

The option cursor-file takes a filename as argument. If the file exists and
contains a valid cursor, this is used to start the output after this position.
At the end, the last cursor gets written to the file.

This allows for an easy implementation of a timer that regularly looks in the
journal for some messages.

    journalctl --cursor-file err-cursor -b -p err
    journalctl --cursor-file audit-cursor -t audit --grep DENIED

Or you might want to walk the journal in steps of 10 messages:

    journalctl --cursor-file ./curs -n10 --since=today -t systemd
This commit is contained in:
Jörg Sommer
2019-02-27 18:43:31 +01:00
committed by Lennart Poettering
parent 200fb167a2
commit d9e15cbd18
4 changed files with 67 additions and 12 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ _journalctl() {
-M --machine -o --output -u --unit --user-unit -p --priority
--root --case-sensitive'
[ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until
--after-cursor --verify-key -g --grep
--after-cursor --cursor-file --verify-key -g --grep
--vacuum-size --vacuum-time --vacuum-files --output-fields'
)