summaryrefslogtreecommitdiff
path: root/test/TEST-04-JOURNAL/test-journal.sh
diff options
context:
space:
mode:
authorLars Karlitski <lars@karlitski.net>2017-10-27 05:10:47 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2017-10-27 12:10:47 +0900
commitcc25a67e2af21833f9fef5aba6e16beafa03b0c7 (patch)
tree404ff13bb957e8b462862c465e01d23b9bfe72be /test/TEST-04-JOURNAL/test-journal.sh
parenta8caf8b251c1f298efc69d0049d53ead2bc98d57 (diff)
downloadsystemd-cc25a67e2af21833f9fef5aba6e16beafa03b0c7.tar.gz
journalctl: add --output-fields= (#7181)
This option allows restricting the shown fields in the output modes that would normally show all fields. It allows clients that are only interested in a subset of the fields to access those more efficiently. Also, it makes the resulting size of the output more predictable. It has no effect on the various `short` output modes, because those already only show a subset of the fields.
Diffstat (limited to 'test/TEST-04-JOURNAL/test-journal.sh')
-rwxr-xr-xtest/TEST-04-JOURNAL/test-journal.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh
index 493ff00ce0..260cae09ab 100755
--- a/test/TEST-04-JOURNAL/test-journal.sh
+++ b/test/TEST-04-JOURNAL/test-journal.sh
@@ -51,6 +51,18 @@ journalctl --sync
journalctl -b -o cat -t "$ID" >/output
cmp /expected /output
+# --output-fields restricts output
+ID=$(journalctl --new-id128 | sed -n 2p)
+printf $'foo' | systemd-cat -t "$ID" --level-prefix false
+journalctl --sync
+journalctl -b -o export --output-fields=MESSAGE,FOO --output-fields=PRIORITY,MESSAGE -t "$ID" >/output
+[[ `grep -c . /output` -eq 6 ]]
+grep -q '^__CURSOR=' /output
+grep -q '^MESSAGE=foo$' /output
+grep -q '^PRIORITY=6$' /output
+! grep -q '^FOO=' /output
+! grep -q '^SYSLOG_FACILITY=' /output
+
# Don't lose streams on restart
systemctl start forever-print-hola
sleep 3