Skip to content

Add Tier 1 fields to systemd journal event data#5139

Merged
joachimmetz merged 1 commit into
log2timeline:mainfrom
kev365:feature-systemd-journal-tier1-fields
Jul 8, 2026
Merged

Add Tier 1 fields to systemd journal event data#5139
joachimmetz merged 1 commit into
log2timeline:mainfrom
kev365:feature-systemd-journal-tier1-fields

Conversation

@kev365

@kev365 kev365 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the Tier 1 field set from the design proposal in #5118, which you
approved ("Please feel free to go ahead ... Let's start with tier 1 and assess
what the volume of additional events is"). Built on the now-merged #5113
binary-safe field decode.

The systemd_journal parser previously surfaced only 5 attributes and discarded
the rest. This adds 14 attributes, most of them trusted (_-prefixed) fields
that journald adds itself and that the logging process cannot forge.

New attributes

attribute journal field
user_identifier _UID
group_identifier _GID
process_name _COMM
executable _EXE
command_line _CMDLINE
systemd_unit _SYSTEMD_UNIT
boot_identifier _BOOT_ID
machine_identifier _MACHINE_ID
transport _TRANSPORT
audit_login_identifier _AUDIT_LOGINUID
selinux_context _SELINUX_CONTEXT
severity PRIORITY (→ syslog label)
facility SYSLOG_FACILITY (→ syslog label)
recorded_time _SOURCE_REALTIME_TIMESTAMP

Also: reporter falls back to the trusted _COMM when SYSLOG_IDENTIFIER is
absent, and the pid docstring is corrected (intstr).

Volume of additional events

The only new attribute that generates timeline events is recorded_time. Across
the four test journals (4,398 entries) it adds 3,177 events on top of the
4,398 written_time events → 7,575 total, +72.2% — only for entries that
carry _SOURCE_REALTIME_TIMESTAMP (measured with log2timeline + pinfo).

Notes / decisions

  • severity / facility as labels, matching syslog:line, for cross-parser
    parity. Per systemd.journal-fields(7) PRIORITY is 0–7 and SYSLOG_FACILITY
    0–23, indexed directly (no RFC 3164 >>3 / &7). These are unvalidated user
    fields — the samples contain e.g. SYSLOG_FACILITY=DHCP4 (NetworkManager) — so
    values are bounds-checked and non-numeric ones yield None silently rather
    than flooding extraction warnings.
  • The severity/facility label tables mirror the ones in
    text_plugins/syslog.py; glad to switch to importing them instead of the local
    copies if you prefer reuse.
  • recorded_time is a distinct second timestamp (source/event time) alongside
    written_time (reception/collection time); for systemd-journal-remote
    relayed journals the two diverge.
  • selinux_context is mapped but absent from the current test samples
    (generated on an AppArmor host), so it ships without a value assertion — happy
    to add one if a SELinux sample is contributed.

Backward compatibility

New attributes default to None; acstore does not serialize None, so entries
that do not populate a field are byte-for-byte unchanged (no event-identity /
dedup-hash change, no storage bloat). No attribute is renamed or removed.

Testing

Expected values are derived from journalctl --output=json ground truth over the
existing test journals — no new test data. Verified locally:
tests.parsers.systemd_journal, tests.engine.timeliner +
tests.engine.yaml_timeliner_file, pylint / black / docformatter / yamllint,
tests.cli.psteal_tool, and the end-to-end suite (clean — no over-claim, no
psort crash).

Surface additional systemd journal fields on systemd:journal event data.
Most are trusted (underscore-prefixed) fields that journald adds itself
and the logging process cannot forge:

  user_identifier (_UID), group_identifier (_GID), process_name (_COMM),
  executable (_EXE), command_line (_CMDLINE), systemd_unit (_SYSTEMD_UNIT),
  boot_identifier (_BOOT_ID), machine_identifier (_MACHINE_ID),
  transport (_TRANSPORT), audit_login_identifier (_AUDIT_LOGINUID) and
  selinux_context (_SELINUX_CONTEXT) as plain passthroughs.

severity (PRIORITY) and facility (SYSLOG_FACILITY) are mapped to the syslog
labels. In the journal these are already plain decimal values (0-7 and
0-23) that index the label tables directly; the RFC 3164 priority-byte
decomposition used for text syslog does not apply. They are unvalidated
user fields, so the values are bounds-checked before use.

recorded_time (_SOURCE_REALTIME_TIMESTAMP) is added as a second timestamp:
the earliest trusted event time on the originating host, distinct from
written_time (journald's reception/collection time). It gets a
timeliner.yaml mapping.

reporter now falls back to the trusted _COMM when SYSLOG_IDENTIFIER is
absent, and the pid docstring is corrected from int to str.

New attributes default to None and are not serialized by acstore, so
entries that do not populate them are byte-for-byte unchanged. Expected
test values are derived from journalctl --output=json ground truth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.18182% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.07%. Comparing base (72cc16e) to head (657d956).

Files with missing lines Patch % Lines
plaso/parsers/systemd_journal.py 93.18% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5139      +/-   ##
==========================================
+ Coverage   85.06%   85.07%   +0.01%     
==========================================
  Files         455      455              
  Lines       40425    40468      +43     
==========================================
+ Hits        34387    34430      +43     
  Misses       6038     6038              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joachimmetz joachimmetz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joachimmetz

joachimmetz commented Jul 8, 2026

Copy link
Copy Markdown
Member

Thanks for the proposed changes. Any indication about the average increase of number of events? Never mind I see it in #5118

@joachimmetz joachimmetz merged commit bfbf988 into log2timeline:main Jul 8, 2026
18 checks passed
@kev365 kev365 deleted the feature-systemd-journal-tier1-fields branch July 8, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants