# Shipping logs to Loki

DevFeed: [Shipping logs to Loki](<https://devfeed.tech/articles/shipping-logs-to-loki-21775.md>)

Original publisher: [Read original article](<https://enoent.fr/posts/production-grade-esphome/02-shipping-logs-to-loki/>)

Author: Marc Plano-Lesay

Published: 2026-04-03T10:10:02Z

Content type: tutorial

Language: en

Sources: [Marc Plano-Lesay](<https://devfeed.tech/sources/marc-plano-lesay.md>)

Topics: [Logging](<https://devfeed.tech/topics/logging.md>), [Monitoring](<https://devfeed.tech/topics/monitoring.md>), [Prometheus](<https://devfeed.tech/topics/prometheus.md>)

Tags: [esphome](<https://devfeed.tech/tags/esphome.md>), [iot](<https://devfeed.tech/tags/iot.md>), [logs](<https://devfeed.tech/tags/logs.md>), [loki](<https://devfeed.tech/tags/loki.md>), [monitoring](<https://devfeed.tech/tags/monitoring.md>), [observability](<https://devfeed.tech/tags/observability.md>), [prometheus](<https://devfeed.tech/tags/prometheus.md>), [server-sent-events](<https://devfeed.tech/tags/server-sent-events.md>), [terminal](<https://devfeed.tech/tags/terminal.md>)

## AI overview

This tutorial explains how to ship ESPHome device logs to Loki. It contrasts logs with Prometheus metrics, describes the ephemeral nature of device logs, and introduces Server-Sent Events and syslog as ways to extract logs for aggregation.

## Source excerpt

When metrics aren't the whole story In the previous post, we set up metrics collection with Prometheus. We can now see what is happening on our devices -- a sensor is failing, the WiFi signal is degrading, or the main loop is running slow. But metrics alone don't tell us why. When a device reboots, the uptime metric resets -- but what caused the reboot? When an entity fails, the _failed metric goes to 1 -- but what error occurred?