Immanetize (talk | contribs) No edit summary |
Immanetize (talk | contribs) |
||
Line 4: | Line 4: | ||
=systemd changes= | =systemd changes= | ||
===systemctl=== | ===systemctl=== | ||
====Filtering by unit state=== | |||
`systemctl` now supports filtering the unit list output by load state. The --state option will accept any value or a comma-separated list values of LOAD, SUB, or ACTIVE states. For example: | `systemctl` now supports filtering the unit list output by load state. The --state option will accept any value or a comma-separated list values of LOAD, SUB, or ACTIVE states. For example: | ||
systemctl --state failed | systemctl --state failed | ||
===journalctl=== | |||
====Viewing the logs of a specific boot==== | |||
`journalctl -b` can be used to look for boot output of a specific boot. For example: | |||
journalctl -b # output from current boot | |||
journalctl -b -1 #output from previous boot | |||
In addition to relative boot sequence, journalctl assigns a 128bit boot ID that can be referenced. For example, | |||
journalctl -b 38fd9c3303574ed38e822233457f6b77 # output from a specific designated boot | |||
===Referencing the journal with 'cursors'=== | |||
journalctl can reference the contents of the journal by a record identifier known as a 'cursor'. Similar to a git hash, the cursor uniquely identifies a point in the journal. | |||
If you add --show-cursor to a journalctl query, the last line of output will contain the cursor value: | |||
journalctl -b -u network --show-cursor --since 15:00 | |||
Sep 08 15:37:59 localhost.localdomain network[4074]: [FAILED] | |||
Sep 08 15:37:59 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1 | |||
Sep 08 15:37:59 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking. | |||
Sep 08 15:37:59 localhost.localdomain systemd[1]: Unit network.service entered failed state. | |||
-- cursor: s=13497722134642a2ac1544bada0c8836;i=1120d;b=8491c05dabd3444ca122e7069b5de0a9;m=db2118a46;t=4e5e7d81c7402;x=d177768ac95df831 | |||
The cursor can be used to identify that point in the journal in a broader query to provide context: | |||
journalctl -c "s=13497722134642a2ac1544bada0c8836;i=1120d;b=8491c05dabd3444ca122e7069b5de0a9;m=db2118a46;t=4e5e7d81c7402;x=d177768ac95df831" | |||
Scripts parsing journalctl's output can store the cursor value and use it on their next run to pick up where they left off: | |||
journalctl --after-cursor "s=13497722134642a2ac1544bada0c8836;i=1120d;b=8491c05dabd3444ca122e7069b5de0a9;m=db2118a46;t=4e5e7d81c7402;x=d177768ac95df831" | |||
Line 15: | Line 40: | ||
[[Category:Draft documentation]] | [[Category:Draft documentation]] | ||
[[Category:Documentation beats]] | [[Category:Documentation beats]] | ||
<!-- There's a bit about journalctl cursor seeking, but I can't find a documented definition of 'cursor' or any usage examples. It appears to be for machine users of the journal only. --> |
Revision as of 00:06, 9 September 2013
systemd changes
systemctl
=Filtering by unit state
systemctl
now supports filtering the unit list output by load state. The --state option will accept any value or a comma-separated list values of LOAD, SUB, or ACTIVE states. For example:
systemctl --state failed
journalctl
Viewing the logs of a specific boot
journalctl -b
can be used to look for boot output of a specific boot. For example:
journalctl -b # output from current boot journalctl -b -1 #output from previous boot
In addition to relative boot sequence, journalctl assigns a 128bit boot ID that can be referenced. For example,
journalctl -b 38fd9c3303574ed38e822233457f6b77 # output from a specific designated boot
Referencing the journal with 'cursors'
journalctl can reference the contents of the journal by a record identifier known as a 'cursor'. Similar to a git hash, the cursor uniquely identifies a point in the journal.
If you add --show-cursor to a journalctl query, the last line of output will contain the cursor value:
journalctl -b -u network --show-cursor --since 15:00 Sep 08 15:37:59 localhost.localdomain network[4074]: [FAILED] Sep 08 15:37:59 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1 Sep 08 15:37:59 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking. Sep 08 15:37:59 localhost.localdomain systemd[1]: Unit network.service entered failed state. -- cursor: s=13497722134642a2ac1544bada0c8836;i=1120d;b=8491c05dabd3444ca122e7069b5de0a9;m=db2118a46;t=4e5e7d81c7402;x=d177768ac95df831
The cursor can be used to identify that point in the journal in a broader query to provide context:
journalctl -c "s=13497722134642a2ac1544bada0c8836;i=1120d;b=8491c05dabd3444ca122e7069b5de0a9;m=db2118a46;t=4e5e7d81c7402;x=d177768ac95df831"
Scripts parsing journalctl's output can store the cursor value and use it on their next run to pick up where they left off:
journalctl --after-cursor "s=13497722134642a2ac1544bada0c8836;i=1120d;b=8491c05dabd3444ca122e7069b5de0a9;m=db2118a46;t=4e5e7d81c7402;x=d177768ac95df831"