Vector Add-on: Ship your Home Assistant logs to VictoriaLogs, Loki or any other supported platform
Hey everyone,
I’d like to share an add-on I built that lets you ship logs from your Home Assistant OS instance using Vector, a compact and versatile log and metrics shipper.
Add-on repository: GitHub - twiebe/hassos-addons
Source code: GitHub - twiebe/hassos-addons-vector
What it does
This add-on runs Vector as a Home Assistant OS service and collects logs from the systemd journal. On Home Assistant OS, that covers everything: host logs, Home Assistant Core, the Supervisor, and all Docker containers running as add-ons. It then ships those logs to any sink that Vector supports.
On startup, the generated Vector configuration is printed to the add-on log (with credentials obfuscated), so you can always verify what’s running without needing shell access.
First-class support for VictoriaLogs and Loki
If you’re running VictoriaLogs or Loki (including Grafana Cloud), the graphical add-on configuration has dedicated options for these sinks - just fill in your endpoint and optional auth credentials and you’re done. Stream fields/labels are auto-generated based on your active transforms, and compression is enabled by default.
Helpful transforms
Two optional transforms can be applied before logs are forwarded:
- Lowercase field names: Journald emits many fields in uppercase (
CONTAINER_NAME,_SYSTEMD_UNIT, etc.). Enable this to normalise everything to lowercase. Much easier on the eyes and more consistent across log backends. - Rename host field: Vector’s journald source uses
hostby default. If your naming convention differs, you can rename it to whatever you need (e.g.hostname).
Both transforms are independent and can be combined.
Full Vector flexibility via config override
For anything not covered by the graphical options, you can supply your own Vector configuration file in the addon’s addon_config directory. Just enable the override option and point it to your config file (default: /config/vector.yaml). When override mode is active, the add-on hands your file directly to Vector, giving you full control over sources, transforms, routing, and sinks.
Why I built it
Two things motivated me to create this:
-
The flexibility of Vector. It supports a huge range of sinks, so no matter what logging backend you’re using today, or might switch to tomorrow, you should be covered. I didn’t want to be locked into a single destination.
-
A customizable host field. I have multiple log sources feeding into my logging stack and I wanted the hostname from Home Assistant to be consistent with the naming convention I use everywhere else. Small thing, but it matters when you’re filtering and correlating logs across sources.
Getting started
- Add the repository to your Home Assistant add-on store:
https://github.com/twiebe/hassos-addons - Install the Vector add-on
- Configure your sink via the add-on options (VictoriaLogs and Loki are point-and-click; for anything else, use the config override)
- Start the add-on and check the log to verify the generated configuration
Log Away
I hope this is useful to some of you. If you encounter any issues, please open an issue in the addon’s repo over at github. Feedback is welcome, too!