10 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
12 printf $
'\n\n\n' | systemd-cat
-t "$ID" --level-prefix false
14 journalctl
-b -o cat -t "$ID" >/output
17 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
19 printf $
'<5>\n<6>\n<7>\n' | systemd-cat
-t "$ID" --level-prefix true
21 journalctl
-b -o cat -t "$ID" >/output
24 # Remove trailing spaces
25 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
26 printf "Trailing spaces\n">/expected
27 printf $
'<5>Trailing spaces \t \n' | systemd-cat
-t "$ID" --level-prefix true
29 journalctl
-b -o cat -t "$ID" >/output
32 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
33 printf "Trailing spaces\n">/expected
34 printf $
'Trailing spaces \t \n' | systemd-cat
-t "$ID" --level-prefix false
36 journalctl
-b -o cat -t "$ID" >/output
39 # Don't remove leading spaces
40 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
41 printf $
' \t Leading spaces\n'>/expected
42 printf $
'<5> \t Leading spaces\n' | systemd-cat
-t "$ID" --level-prefix true
44 journalctl
-b -o cat -t "$ID" >/output
47 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
48 printf $
' \t Leading spaces\n'>/expected
49 printf $
' \t Leading spaces\n' | systemd-cat
-t "$ID" --level-prefix false
51 journalctl
-b -o cat -t "$ID" >/output
54 # --output-fields restricts output
55 ID
=$
(journalctl
--new-id128 |
sed -n 2p
)
56 printf $
'foo' | systemd-cat
-t "$ID" --level-prefix false
58 journalctl
-b -o export --output-fields=MESSAGE
,FOO
--output-fields=PRIORITY
,MESSAGE
-t "$ID" >/output
59 [[ `grep -c . /output` -eq 6 ]]
60 grep -q '^__CURSOR=' /output
61 grep -q '^MESSAGE=foo$' /output
62 grep -q '^PRIORITY=6$' /output
63 ! grep -q '^FOO=' /output
64 ! grep -q '^SYSLOG_FACILITY=' /output
66 # Don't lose streams on restart
67 systemctl start forever-print-hola
69 systemctl restart systemd-journald
71 systemctl stop forever-print-hola
72 [[ ! -f "/i-lose-my-logs" ]]
74 # https://github.com/systemd/systemd/issues/4408
76 systemctl start forever-print-hola
78 systemctl
kill --signal=SIGKILL systemd-journald
80 [[ ! -f "/i-lose-my-logs" ]]