I'm trying to filter some journald logs which might have some-what similar information in different keys.
journalctl -o json | head -n 1000 | jq '.UNIT, .USER_UNIT, ._SYSTEMD_UNIT
Those 3 keys might have the unit name, depending on how the log entry was created (by the unit, by the system starting the unit, etc)... I don't care about this and just want to get the related-unit.
How can I extract something like jq '.UNIT OR .USER_UNIT OR ._SYSTEMD_UNIT
(or
doesn't work as it is a boolean converter to be used in select()
, and |
tries to route to a function)
I also cannot use +
because when .UNIT
key is present there will be something i don't want to collect in ._SYSTEMD_UNIT
.