avocado-ext-logging: journald -> MQTT streaming - #1
Open
yoctopidg3 wants to merge 1 commit into
Open
Conversation
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>
There was a problem hiding this comment.
🟡 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 on lines
+14
to
+15
| license: MIT | ||
| url: https://github.com/avocado-linux/ext-logging |
Contributor
There was a problem hiding this comment.
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). | |||
Contributor
|
Please sign all commits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
/varwith a rolling window and streams it to a broker by pipingjournalctl -o jsontomosquitto_pub(one entry per message). Pullsmosquitto-clientsfrom 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-logdwork.Built for qemux86-64 and verified: the full boot journal (incl. backlog) streams over MQTT.