Skip to content

Journald with humanlog

Grigory Zubankov edited this page May 21, 2018 · 1 revision
  • Install jq:

e.g. for CentOS: yum install jq

  • Install humanlog
  • View humanised logs using the following one-liner:
journalctl --output json \
| jq -cr '(.|to_entries|map(select(.key|test("^_.*") != true))|map({"key":.key|gsub("_";"-")|ascii_downcase, "value":.value})|from_entries) + {"ts": ((._SOURCE_REALTIME_TIMESTAMP // 0)|tonumber/1000000), "message": .MESSAGE, "lvl": {"7":"debug", "6":"info", "5":"notice", "4":"warning", "3":"error", "2":"critical", "1":"alert", "0":"emergency"}[.PRIORITY]}' \
| humanlog \
| less -SR
Clone this wiki locally