From 99c92e62f84eea92e82d2ba90927a9213623fbd7 Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Tue, 11 Mar 2025 16:14:26 +0100 Subject: [PATCH] journal hostname label --- templates/config.alloy.erb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/config.alloy.erb b/templates/config.alloy.erb index a62bb09..cb42379 100644 --- a/templates/config.alloy.erb +++ b/templates/config.alloy.erb @@ -10,11 +10,14 @@ loki.source.syslog "syslog" { // Process logs and extract hostname loki.process "extract_hostname" { - stage.logfmt {} - + stage.logfmt { + mapping = { + "hostname" = "syslog_hostname", // Extracts the hostname from syslog + } + } stage.labels { values = { - hostname = "syslog_hostname", + "hostname" = "hostname", // Assigns extracted hostname to the label } } forward_to = [loki.write.loki.receiver]