Skip to content

Conversation

@IngmarStein
Copy link

I was trying to send HA logs to Grafana Alloy which has standard-compliant parsers for RFC3164 and RFC5424. Unfortunately, as noted in #27, version 0.4.1 of this add-on doesn't conform to either standard.

This PR is similar to #27 but adds a dropdown option for the syslog format with the previous format as the default and a new RFC5424-compliant option.

The PR also bumps a few dependencies and drops the architectures which were recently removed from the HA builder.

Updates the syslog formatter to produce messages following the RFC 5424 standard.
- Implements `RFC5424Formatter` for ISO 8601 timestamps with high precision.
- Updates log format to include version, app-name, procid, and NILVALUEs.
- Extracts process ID (`_PID`) from journal entries.
- Ensures default values (`-`) for missing fields.
- Supports RFC3164 (default) and RFC5424 formats.
- Updates configuration and translations.
- Exports SYSLOG_FORMAT environment variable.
The previous regex r'\x1b[[\]\d+m' was invalid and caused a re.PatternError. It has been replaced with r'\x1b\[[0-9;]*m' which correctly matches standard ANSI escape sequences.
@w531t4
Copy link

w531t4 commented Dec 13, 2025

I wish i would have looked at existing pull requests first. Anyways, I tested this in my infra today and it works great. thanks @IngmarStein!

(i tested RFC5424)

@IngmarStein
Copy link
Author

You're welcome @w531t4, glad you found it useful!
Now that HA stopped writing homeassistant.log, I assume more people are looking at syslog…
@mib1185 wdyt about merging this option? I'd love to drop my fork and use your original again.

@mib1185
Copy link
Owner

mib1185 commented Dec 14, 2025

Hi @IngmarStein
many thanks for this contribution and I'm happy to review this PR. But first we should limit it to only handle one topic (the rfc5424 option).
The other changes should go in different PRs. and btw. I'm not planing to remove the un-supported platforms yet, as there might be users still using them and as long as there is not technical reason to remove the support, I will keep it.

@IngmarStein
Copy link
Author

@mib1185 sure, understood. The reason why I removed the unsupported platforms is because new current builder image no longer has these architectures anymore so the project didn't build with 2025.11.0 (https://github.com/home-assistant/builder/releases/tag/2025.11.0). The decisions to drop these architectures were already made by HA core team in February and April.

@mib1185
Copy link
Owner

mib1185 commented Dec 14, 2025

yeah, I know, therefore I drafted #29 for now to keep the current builder version running as long as possible.

@IngmarStein
Copy link
Author

Sure! Feel free to cherry-pick only the parts you like.

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