How to Export systemd Journal Logs with journalctl

How to Export systemd Journal Logs with journalctl

SOC Prime Team
SOC Prime Team linkedin icon Follow

Run journalctl with a time window and -o json, and you get one JSON object per line with every field the journal stored:

sudo journalctl --since "2026-10-19 00:00" --until "2026-10-20 00:00" -o json --no-pager > web-03_journal.jsonl

For a syslog-style text file instead, use -o short-iso. Without sudo, or membership in systemd-journal, adm or wheel, you see only your own user journal, not the system’s.

On most modern distros, the journal is where everything lands first: services, the kernel, sudo, cron, logins. On Debian 12 and later, Fedora and Arch, it’s often the only place, because rsyslog isn’t installed. Prime Core has {N} detection rules for Linux system logs, mapped to {M} MITRE ATT&CK techniques, among them cron persistence (T1053.003), malicious systemd services (T1543.002) and sudo abuse (T1548.003).

Get Started for Free

Before you start

Permissions. Same rules as for any system log: root, or the groups above. Our [Linux log permissions guide] has the details.

Does the journal survive reboots? If /var/log/journal doesn’t exist, logs live in memory under /run/log/journal and disappear on reboot. journalctl –list-boots shows how many boots you actually have. If it lists only the current one, older history is gone.

How much is there? journalctl –disk-usage tells you before you dump it all into a file. By default, a persistent journal can grow to 10% of its filesystem, capped at 4 GB. That’s far more than you want to upload in one piece.

Time zones. The journal stores timestamps in UTC, but journalctl prints local time unless you add –utc. JSON output carries the raw UTC microsecond timestamp (__REALTIME_TIMESTAMP) either way.

Step 1: Narrow it down

Pick the filters that match your question. They combine:

FilterWhat it does
–since / –untilTime window; accepts “2026-10-19 14:00”, yesterday or “2 hours ago”
-b, -b -1Current boot, previous boot
-u nginx -u sshOne or more systemd units
-p warningThat priority and anything more severe
-kKernel messages only
_COMM=sudo, _UID=0Match any journal field exactly

Step 2: Pick the output format

  • -o json: one JSON object per line, with every field. This is the default choice for LogTotal, because nothing gets lost.
  • -o json –output-fields=MESSAGE,_HOSTNAME,_COMM,_PID,SYSLOG_IDENTIFIER,PRIORITY: the same, trimmed. A few fields, such as the timestamps and the boot ID, are always included. This cuts file size dramatically.
  • -o short-iso: syslog-style text with full ISO timestamps. Smaller and easy to read by eye. [PROOF: confirm LogTotal parses short-iso]

Don’t use -o export. Despite the name, it’s a serialization format for shipping journals between systemd machines, not something to analyze.

We recommend you a typical scoped export:

sudo journalctl -b -1 -p info -u ssh -u cron \

  -o json --no-pager > web-03_prevboot.jsonl

Step 3 (optional): Read journal files from another machine

In incident work, you often have a disk image or a copied /var/log/journal folder rather than a live system. journalctl reads those directly:

journalctl -D /mnt/evidence/var/log/journal -o json --no-pager > evidence_journal.jsonl

Use –file to point at individual .journal files. A journal from a crashed or uncleanly shut down system may print corruption warnings. Most entries usually still come out.

Upload, sanitize and review in LogTotal

  1. Upload. Open logtotal.com and drop in the .jsonl file. [PROOF: upload screen, size limit]
  2. Sanitize. [PROOF: what gets masked in journal JSON: hostnames, usernames, IPs, machine and boot IDs]. Look it over before you continue.
  3. Review. [PROOF: what the results screen shows]

What this looks like on real data. We exported a day of journal from [PROOF: sample source, e.g. a throwaway test VM after adding a cron job, a new user and a suspicious systemd service]. LogTotal flagged [PROOF: actual findings]. [PROOF: link to the sample file]

When it goes wrong

SymptomLikely causeFix
Hint about not seeing messages from other usersNot root, and not in the journal groupssudo, or add the account to systemd-journal
— No entries —Time window or unit name doesn’t match; local vs. UTC confusionWiden the window; try –utc; check systemctl list-units
Only the current boot existsVolatile journalOlder logs are gone; check your log forwarder or SIEM
Output looks binary or garbled-o export was usedUse -o json
The file is gigabytesNo filtersAdd units, priority, –output-fields

FAQ

JSON or text?

JSON for analysis, because it keeps PID, unit, boot ID and exact timestamps as separate fields. Text when a person will read it, or when size matters.

Is the journal the same as /var/log/syslog?

No. When rsyslog is installed, it copies messages from the journal into text files, so you may have both. When it isn’t, the journal is all there is.

Join SOC Prime's Detection as Code platform to improve visibility into threats most relevant to your business. To help you get started and drive immediate value, book a meeting now with SOC Prime experts.