[systemd-devel] [PATCH v3] journalctl: Add support for showing messages from a previous boot
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Jun 9 15:15:05 PDT 2013
On Wed, Jun 05, 2013 at 02:32:35PM +0200, Jan Janssen wrote:
> <varlistentry>
> - <term><option>-b</option></term>
> - <term><option>--this-boot</option></term>
> -
> - <listitem><para>Show data only from
> - current boot. This will add a match
> - for <literal>_BOOT_ID=</literal> for
> - the current boot ID of the
> - kernel.</para></listitem>
> + <term><option>-b <optional><replaceable>ID</replaceable></optional></option></term>
> + <term><option>--boot=<optional><replaceable>ID</replaceable></optional></option></term>
> +
> + <listitem><para>Show messages from specified
> + boot <replaceable>ID</replaceable>. This will
> + add a match for <literal>_BOOT_ID=</literal>.</para>
> +
> + <para>The argument is a 128 bit ID given in
> + short or UUID form and optionally followed by
> + <literal>:n</literal> which identifies the nth
> + boot relative to the boot ID given to the left
> + of <literal>:</literal>. Supplying a negative
> + value will look for a past boot and a positive
> + value for a future boot. The boot IDs are
> + searched for in chronological order.</para>
> +
> + <para>If no number is provided after
> + <literal>:</literal>, <literal>-1</literal> is
> + assumed. A value of 0 is valid and equivalent to
> + omitting <literal>:0</literal>. The boot ID may
> + be omitted if <literal>:</literal> is provided,
> + which will assume the current boot ID as the
> + reference.</para>
> +
> + <para>For example, if <literal>962e0810b0c44735a6a70e7132996502</literal>
> + were the ID of the current boot, the following
> + are all equivalent:
> + <option>962e0810b0c44735a6a70e7132996502</option>,
> + <option>962e0810-b0c4-4735-a6a7-0e7132996502</option>,
> + <option>:0</option>,
> + <option>962e0810b0c44735a6a70e7132996502:0</option>,
> + <option>962e0810-b0c4-4735-a6a7-0e7132996502:0</option>.
> + Additionally, if <literal>04089164-6fb3-4826-a7d1-207b11a02169</literal>
> + were the previous boot ID the following are equivalent:
> + <option>040891646fb34826a7d1207b11a02169</option>,
> + <option>04089164-6fb3-4826-a7d1-207b11a02169</option>,
> + <option>:-1</option>, <option>:</option>,
> + <option>962e0810b0c44735a6a70e7132996502:-1</option>,
> + <option>962e0810-b0c4-4735-a6a7-0e7132996502:-1</option>.
> + <para>Show all kernel logs from last boot:</para>
> +
> + <programlisting>journalctl -k -b :</programlisting>
> +
Hm, I somehow don't find this user interface convincing... For me, the
most common usecases are:
1 (by far) - show current boot
2 (occasionally) - show previous boot
I guess that if I had the ability to show next-previous,
next-next-previous, ..., boots, I would sometimes use that. But I
think we should foremost make the two usecases above easy.
IMHO, the argument to --boot should be optional, and should default to
"current boot". This way we keep also compatibility with current
interface. Also, I don't see why we would need to allow boot id's
with dashes: we don't allow that currently, and the only likely source
of a boot id is the user using the mouse to copy the boot id from
journalctl output, so there's little point.
With dashes and colons out of the way, I'd propose:
-0 or 0 or nothing to refer to current boot,
-1 to refer to previous boot,
and so on,
1 to refer to first boot ever [1, 2],
2 to the second boot, etc.
And <bootid> to refer to boot <bootid>,
<bootid>-0 and <bootid>+0 to refer to <bootid>,
<bootid>-1, <bootid>-2, to refer to earlier boots,
and <bootid>+1, <bootid>+2 to refer to later boots.
Zbyszek
[1] ...well, ever means since the beginning of logs here :)
[1] Should boots since installation be numbered from 0 or 1?
I kind of like numbering them from 0, but the scheme I
outlined above means that we have consistent meaning for
all numbers modulo number of boots, with current boot
being 0.
More information about the systemd-devel
mailing list