Export journald logs to JSON

Export logs as structured JSON (time and message), for example to send them to a log aggregator.

journalctl -u <service> -o json | jq '{ts: .REALTIME_TIMESTAMP, msg: .MESSAGE}'

tool
linux133 commands
tags
linuxlogs

More linux commands

  • timedatectl status && chronyc tracking

    Show clock sync state, time offset and NTP source details.

  • systemctl list-timers --all --no-pager

    List all timers with their last and next run times.

  • ssh-copy-id -i ~/.ssh/id_ed25519.pub user@host

    Add your public key to authorized_keys on a remote host.

  • rsync -avz --progress --delete src/ user@host:/dest/

    Mirror a directory to a remote host and delete files that are not in the source.

  • shred -vzn 1 /dev/sdb

    Overwrite the disk once with random data, then with zeros, and show progress. For SSD and NVMe, use the drive's built-in secure erase instead.

all 133 linux commands