From fc7f606e8a7d4480441f69dd4f650be216a9599d Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Tue, 11 Mar 2025 13:41:04 +0100 Subject: [PATCH] source hostname label --- templates/config.alloy.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/config.alloy.erb b/templates/config.alloy.erb index b5f2f72..018c136 100644 --- a/templates/config.alloy.erb +++ b/templates/config.alloy.erb @@ -12,11 +12,11 @@ local.file_match "system_logs" { loki.process "syslog" { stage.regex { - expression = `(?P[A-Z][a-z][a-z]\\s{1,2}\\d{1,2}\\s\\d{2}[:]\\d{2}[:]\\d{2})\\s(?P[\\w][\\w\\d\\.@-]*)\\s(?P.*)$` + expression = `(?P[A-Z][a-z]{2}\s{1,2}\d{1,2}\s\d{2}:\d{2}:\d{2})\s(?P[\w\.\@-]+)\s(?P.*)$` } stage.labels { values = { - hostname = "host" + hostname = "${host}" } } stage.timestamp { @@ -29,6 +29,7 @@ loki.process "syslog" { forward_to = [loki.write.loki.receiver] } + loki.write "loki" { endpoint { url = "<%= @ay_loki_url %>"