Skip to content

rhizomatics/remote_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

135 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remote Logger{ align=left }

Home Assistant Remote Logger

Rhizomatics Open Source hacs

Ruff pre-commit.ci status Coverage Tests Github Deploy CodeQL Dependabot Updates




Listens to Home Assistant system log events and sends structured log events to a remote Syslog or OpenTelemetry (OTLP) collector. Optionally forwards other Home Assistant events, such as lifecycle events, service calls, configuration updates, state changes.

Example OTEL Stack Trace{width=600}

Logs structure is preserved from the Home Assistant internal event, so multi-line logs and stacktraces are preserved as single log entries, unlike console scrapers which will create a log event per line, and will capture script names, line numbers and versions properly.

Only Home Assistant server itself, with its custom components is supported. Logs from apps (previously known as 'add-ins'), HAOS or the HA Supervisor aren't provided as events to be captured, so require an alternative solution, like Bert Baron's LogSpout Home Assistant App will cover these. It can be used in combination with Remote Logger so that Home Assistant has good structured logs, and everything else is at least logged.

Translations are available for Dutch, English, French, German, Hindi, Italian, Japanese, Polish, Portuguese, Simplified Mandarin and Spanish.

Installation

Remote Logger is a HACS component, so that has to be installed first, using the instruction at Getting Started with HACS.

The integration installs using the Home Assistant integrations page, and has no YAML configuration.

Choose Integration{width=400}

However, a YAML change is required to the Home Assistant System Log integration, to enable event forwarding for system_log_event.

system_log:
    fire_event: true

Open Telemetry (OTEL)

Logs are sent using Open Telemetry Logs specification over a Open Telemetry Protocol(OTLP) connection, either as Protobuf or JSON, and currently only as HTTP (gRPC may be added in future).

Configure OTLP{width=480}

For more information, see OpenTelemetry Logging.

Log records are collected and sent in a bundle

Syslog

Messages are sent using the more recent RFC5424 format, with additional structured data using OTEL taxonomy (see Additional Attributes).

Syslog can be sent as TCP or UDP.

Configure Syslog{width=360}

Events

System Log Event

Note the requirement at Installation to enable this event, which isn't fired by default.

Remote Logger will omit its own log events from the stream, to prevent the possibility of event loops. As an alternative, error stats and messages are available as diagnostic entities.

Additional Attributes

The following additional attributes, derived directly from the Home Assistant log event, are provided as Syslog STRUCTURED-DATA attributes, or OTEL attributes.

  • code.file.path
  • code.line.number
  • code.function.name (this is the logger value from Home Assistant)
  • exception.count
  • exception.first_occurred
  • exception.stacktrace

OTEL taxonomy is used for both OTEL and Syslog since there's no standard taxonomy at this level of Syslog.

Other Events

Remote Logger can log any Home Assistant event, and knows about the core ones, in order to create a more readable message.

For convenience, four pre-defined bundles of events can be switched on.

Bundle Description
Lifecycle Home Assistant server start and stop events
Core Changes Components and services loading or unloading, config reapplied
Core Activity Actions, mobile actions, scripts, automations executed
State Changes Entity state changes and log book entries, with states stripped of attributes and context to avoid huge log entries
Full State Changes Entity state changes and log book entries, full and untrimmed

The free-form event box can be used as an alternative to pick specific Home Assistant events, or any other custom component events.

Home Assistant Events in OpenObserve{width=720}

Log Servers

There are a zillion possible solutions for capturing, analyzing, aggregating and storing logs.

One combination that works well is using Vector and GreptimeDb - they are fast, lightweight, open source, customizable and run under Docker. Vector has support for OTEL logging, as well as Syslog, and has good remapping ability to fine tune each source. Its then easy to pull in logs from Docker servers, firewalls, Unifi switches or wherever else into one time-line, as well as server and network metrics.

Diagnostic Entities

Home Assistant sensors are created and updated to monitor log activity, plus any errors either generating log messages or posting them to remote servers.

Diagnostic Entities{width=480}

Rhizomatics Open Source for Home Assistant

HACS

  • AutoArm - Automatically arm and disarm Home Assistant alarm control panels using physical buttons, presence, calendars, sun and more
  • Supernotify - Unified notification for easy multi-channel messaging, including powerful chime and security camera integration.

Python / Docker

  • Anpr2MQTT - Integrate with ANPR/ALPR licence plate cameras via file system (NAS/FTP) to MQTT with optional image analysis and UK DVLA integration.
  • Updates2MQTT - Automatically notify via MQTT on Docker image updates, with advanced handling to extract versions and release notes from images, and option to remotely pull and restart containers from Home Assistant. Also available on PyPI