Skip to content

avocado-ext-logging: journald -> MQTT streaming - #1

Open
yoctopidg3 wants to merge 1 commit into
avocado-linux:mainfrom
yoctopidg3:pidge/observability
Open

avocado-ext-logging: journald -> MQTT streaming#1
yoctopidg3 wants to merge 1 commit into
avocado-linux:mainfrom
yoctopidg3:pidge/observability

Conversation

@yoctopidg3

Copy link
Copy Markdown

Standalone logging extension (splitting the observability work out of avocado-os per review — replaces the closed avocado-os#50).

What

journald → MQTT. systemd-journald is the collector; the extension persists the journal to /var with a rolling window and streams it to a broker by piping journalctl -o json to mosquitto_pub (one entry per message). Pulls mosquitto-clients from the feed; overlay carries the journald drop-in, the service, and its env config.

Milestone 1 scope

Direct-broker path: no TLS/redaction/cursor/backend-gating (documented in the README). Filtering + redaction + a single authenticated uplink are future avocado-logd work.

Built for qemux86-64 and verified: the full boot journal (incl. backlog) streams over MQTT.

Fill the ext-template into a standalone logging extension. systemd-journald is
the collector; the extension persists the journal (rolling window) and streams
it to a broker by piping `journalctl -o json` to mosquitto_pub. Pulls
mosquitto-clients from the feed; M1 direct-broker (no TLS/redaction/gating yet,
documented in the README).

Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are concrete security/operational issues to address (shell argument handling in the unit, auth/TLS documentation mismatch, and missing LICENSE file despite license: MIT).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Introduces avocado-ext-logging, an Avocado OS extension that persists systemd-journald logs to disk and streams journal entries to an MQTT broker using journalctl -o json piped into mosquitto_pub.

Changes:

  • Add systemd service + env config to stream journald JSON entries to MQTT.
  • Add journald drop-in to enable persistent journal storage with a rolling retention window.
  • Update extension metadata/docs (README, avocado.yaml, changelog) and pull in mosquitto-clients.
File summaries
File Description
README.md Documents the extension, configuration, and Milestone 1 scope.
overlay/usr/lib/systemd/system/avocado-log.service New systemd unit that pipes journalctl into mosquitto_pub.
overlay/etc/systemd/journald.conf.d/10-avocado-log.conf New journald drop-in enabling persistence + retention limits.
overlay/etc/avocado-log/avocado-log.env Default runtime configuration for broker/topic/journalctl args.
CHANGELOG.md Renames template changelog header to this extension.
avocado.yaml Declares the extension package, dependencies, overlay, and service enablement hooks.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4 to +9
# Broker. Set LOG_BROKER to your MQTT host. No TLS/auth in Milestone 1 —
# point only at a broker you trust on a trusted network.
LOG_BROKER=127.0.0.1
LOG_PORT=1883
# LOG_USER=
# LOG_PASSWORD=
Comment thread avocado.yaml
Comment on lines +14 to +15
license: MIT
url: https://github.com/avocado-linux/ext-logging

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.

please change to apache, like our other tools

Comment on lines +11 to +13
ExecStart=/bin/sh -c 'H=$(hostname); T=$(printf %%s "$LOG_TOPIC" | sed "s/{host}/$H/"); \
AUTH=""; [ -n "$LOG_USER" ] && AUTH="-u $LOG_USER -P $LOG_PASSWORD"; \
journalctl $JOURNAL_ARGS | mosquitto_pub -h "$LOG_BROKER" -p "$LOG_PORT" -t "$T" $AUTH -l'
@@ -0,0 +1,9 @@
# Avocado Log — persist the journal to disk with a rolling window.
# Without this, Avocado's journald is volatile (RAM only) and boot logs vanish.
# Writes to the btrfs /var partition (only writable store on the ro rootfs).
@nicksinas

Copy link
Copy Markdown
Contributor

Please sign all commits

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.

3 participants