From a331b5e6d4724365bad9edeb9420c7e26e7f50da Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 28 Jun 2013 17:26:30 +0200 Subject: journalctl: Add support for showing messages from a previous boot Hi, I redid the boot ID look up to use enumerate_unique. This is quite fast if the cache is warm but painfully slow if it isn't. It has a slight chance of returning the wrong order if realtime clock jumps around. This one has to do n searches for every boot ID there is plus a sort, so it depends heavily on cache hotness. This is in contrast to the other way of look-up through filtering by a MESSAGE_ID, which only needs about 1 seek + whatever amount of relative IDs you want to walk. I also have a linked-list + (in-place) mergesort version of this patch, which has pretty much the same runtime. But since this one is using libc sorting and armortized allocation, I prefer this one. To summarize: The MESSAGE_ID way is a *lot* faster but can be incomplete due to rotation, while the enumerate+sort will find every boot ID out there but will be painfully slow for large journals and cold caches. You choose :P Jan --- man/journalctl.xml | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'man/journalctl.xml') diff --git a/man/journalctl.xml b/man/journalctl.xml index b8b29b4cb5..0e779b952c 100644 --- a/man/journalctl.xml +++ b/man/journalctl.xml @@ -327,23 +327,51 @@ - - - - Show data only from - current boot. This will add a match - for _BOOT_ID= for - the current boot ID of the - kernel. + + + + Show messages from the specified + boot ID or from + current boot if no ID + is given. This will add a match for + _BOOT_ID=. + + The argument is a 128 bit ID given in + short or UUID form and optionally followed by + :n which identifies the nth + boot relative to the boot ID given to the left + of :. Supplying a negative + value for n will look for a past boot and a + positive value for a future boot. The boot IDs + are searched for in chronological order. If no + number is provided after :, + -1 is assumed. A value of 0 + is valid and equivalent to omitting + :0. + + Alternatively, the argument may constist + only of :n. In this case, a + positive value will look up the nth boot + starting from the beginning of the jouranl, a + negative value will look up a previous boot + relative to the current boot. :0 + will look for the current boot ID. Thus, + :1 is the first boot found in + the journal, :2 the second + and so on; while :-1 is the + previous boot, :-2 the boot + before that and so on. Omitting a value after + : will look for the previous + boot. - Show kernel messages from - current boot. This implies - and adds the match _TRANSPORT=kernel. + Show only kernel messages. This + implies and adds the match + _TRANSPORT=kernel. @@ -721,6 +749,10 @@ journalctl /dev/sda + Show all kernel logs from last boot: + + journalctl -k -b : + -- cgit v1.2.3-54-g00ecf