Docker container that listens to incoming syslogs and pushes to a loki instance
976
A simple Docker image that accepts Syslog messages (TCP/UDP port 514) and forwards them to a Grafana Loki instance. Built using Grafana Alloy.
source_ip: IP address of the sender.hostname: Hostname of the sender (if resolvable).facility: Syslog facility.severity: Syslog severity.app_name: Program name from the syslog message.protocol: tcp or udp.docker run -d \
--name syslog-to-loki \
-p 514:514/udp \
-p 514:514/tcp \
-e LOKI_URL="http://loki:3100/loki/api/v1/push" \
--restart=always \
dewgenenny/syslog-to-loki
| Variable | Description |
|---|---|
LOKI_URL | Full URL to the Loki push API (e.g., http://localhost:3100/loki/api/v1/push) |
If Alloy fails to start with an error similar to:
Error: /etc/alloy/config.alloy:<line>:<column>: unrecognized attribute name "format"
make sure your loki.source.syslog listener blocks use syslog_format = "rfc3164" (or another valid value). The older format = "rfc3164" key is not recognized by newer Alloy releases.
docker build -t dewgenenny/syslog-to-loki .
You can test it using the logger command (if available) or netcat.
Using logger:
logger -n localhost -P 514 --udp -t myapp "Hello Loki"
Using netcat (RFC 3164):
echo "<13>Oct 1 12:00:00 localhost myapp: Simple test message" | nc -u -w 1 localhost 514
Content type
Image
Digest
sha256:aeefb613a…
Size
144.3 MB
Last updated
9 months ago
docker pull dewgenenny/syslog-to-loki