Skip to content

feat(recommendations): add a Linux catalogue from systemd's journal message catalog - #496

Open
TheWitness wants to merge 1 commit into
developfrom
feat/linux-systemd-catalogue
Open

TheWitness wants to merge 1 commit into
developfrom
feat/linux-systemd-catalogue

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

Adds a manually importable Linux recommendation catalogue, built from systemd's journal message catalog, following the same model as the other vendor catalogues in docs/.

No vendor publishes a Linux equivalent of Cisco's CEMDB. systemd's catalog is the only public, licence-compatible source keyed on a stable message identifier: the journal MESSAGE_ID.

Changes

  • docs/linux.json.gz: 102 records from catalog/systemd.catalog.in at systemd v262.2 (LGPL-2.1-or-later). The identifier is the 32-digit hex MESSAGE_ID, which already fits the lookup tokenizer.
    • message is the entry's Subject, component its Defined-By and explanation the prose, with any Documentation URIs appended.
    • severity is null and recommended_action is empty, because the catalog has neither.
    • 20 entries, mostly fatal PID 1 errors, have only a Subject; it is used as their explanation.
  • contrib/recommendations/extract_systemd_catalog.py (new): converts a catalog source file into syslog-recommendations JSON. build_catalogues.py now accepts linux, and the build is byte-reproducible.
  • Vendor detection (syslog_recommendation_vendor_from_device): a device whose sysDescr or template mentions Linux and names no network vendor is now Linux.
    • Network vendors are still checked first across both the description and the template, so Cumulus, Nokia SR Linux, or an Arista template on a Linux sysDescr keep their vendor.
    • This only changes lookups once Linux records exist, because scoping requires records for the vendor.
  • Docs: README gains a "Linux and systemd message IDs" section, the vendor list and the catalogue table row. RECOMMENDATION_SOURCES.md gains a Linux section with the source, licence, build commands and gaps. CHANGELOG updated.

Forwarder requirement

Plain syslog does not carry MESSAGE_ID, so the sending Linux host must append MESSAGE_ID=<id>. The README has rsyslog (imjournal, $!MESSAGE_ID) and syslog-ng (systemd-journal(), ${.journald.MESSAGE_ID}) examples. Both were tested end to end against a live journal with rsyslog 8.2604 and syslog-ng 3.35 on AlmaLinux 9: entries with an ID get the suffix, and entries without one are forwarded unchanged.

Testing

  • RecommendationsTest.php: catalogue-load row for linux.json.gz (102 records), new vendor-detection cases, and an end-to-end lookup test. The test checks that a forwarded MESSAGE_ID= from a Linux device matches the Linux record, and that a Cisco identifier from that device no longer matches.
  • Full Pest suite against Cacti 1.2.x: 902 passed. The one warning (ProcessHelperCompatTest /proc probe) is also present on develop.
  • Locally the full suite needs memory_limit above 128M to load the Cisco catalogue; develop behaves the same.

Not covered (follow-ups)

Most Linux services (sshd, the kernel, postfix and others) log without a MESSAGE_ID. Covering them needs pattern-based matching, for example from the Wazuh/OSSEC GPL-2.0 rulesets, plus hand-curated recommended actions.

…essage catalog

Add docs/linux.json.gz, a manually importable catalogue of the 102 entries
in systemd v262.2's catalog/systemd.catalog.in (LGPL-2.1-or-later), keyed on
the journal MESSAGE_ID. contrib/recommendations/extract_systemd_catalog.py
converts the catalog for build_catalogues.py, which now accepts linux.

Devices whose sysDescr or template mentions Linux but names no network
vendor are recognised as Linux for recommendation scoping; a named vendor
in either still wins.

The README documents rsyslog (imjournal) and syslog-ng (systemd-journal)
forwarder templates that append MESSAGE_ID=<id> to forwarded messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 15:50
@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the Linux recommendation catalogue changes.

No open issues 🎉

What changed in this PR

Adds Linux support to the existing recommendation catalogue system using 102 systemd journal message IDs.

Changes:

  • Adds catalogue extraction tooling and Linux build support.
  • Recognises Linux devices while preserving network-vendor precedence.
  • Documents forwarding requirements and adds catalogue-loading, vendor-detection and lookup tests.
File Description
tests/​Unit/​RecommendationsTest.php Tests Linux catalogue loading, detection and forwarded-ID matching.
README.md Documents Linux support and forwarder configuration.
includes/​recommendations.php Adds Linux as a fallback vendor classification.
docs/​RECOMMENDATION_SOURCES.md Records catalogue provenance, build steps and coverage gaps.
contrib/​recommendations/​extract_systemd_catalog.py Converts systemd catalogue entries into recommendation JSON.
contrib/​recommendations/​build_catalogues.py Accepts Linux catalogue builds.
CHANGELOG.md Records the Linux recommendation feature.

Review effort: Balanced

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