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]