Stream home assistant logs to a central log server

Could someone please guide me on how I can stream the HA logs over to a central log server?
The options I can think of are…

  1. Install rsyslog on the host OS and pass a path to the HA file, so that it can be streamed vis rsyslog. [X Not possible as HassOS doesn’t have a package manager to install rsyslog.]
  2. Update the docker image for Home Assistant to include the following lines, so that a remote log server receives the docker logs at least. [X Not possible in HassOS as it only pulls the default HA dockerfile.]
{
  "log-driver": "syslog",
  "log-opts": {
    "syslog-address": "udp://1.2.3.4:514"
  }
}

Am I over-complicating this. Could someone please point me to any simpler solutions that I might be missing?

This is a feature missing from home assistant that should seriously be given some thought.

2 Likes

Ah, I see. I voted on the feature, but I was hoping to get some alternate ideas that I may be missing :frowning:

My current workaround for some extensions is to install and enable portainer and configure the containers I’m interested on to use the gelf driver so I can send the logs to my graylog instance.

EDIT:
Oh dam, I spoke too soon, the portainer extension does not have access to the underliying containers (even in non protected mode) what a pitty.

EDIT2:
You need to unhide the containers on portainer settings. But in any case, adding the log configuration to each container not only does not scale, but gets reset on every update of the addon or home-assistant.
However, you can suck the logs by adding a container running a logging collector and give it access to docker.sock

1 Like