From 8ff5fbfa61d0480769841e6b81c4b99d464e64e4 Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Tue, 11 Mar 2025 14:49:30 +0100 Subject: [PATCH] add hostname label --- templates/config.alloy.erb | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/templates/config.alloy.erb b/templates/config.alloy.erb index 2131b0f..a894822 100644 --- a/templates/config.alloy.erb +++ b/templates/config.alloy.erb @@ -20,22 +20,12 @@ loki.source.file "system_logs" { loki.relabel "add_labels" { forward_to = [loki.write.loki.receiver] - rule { - action = "replace" - source_labels = ["__host__"] - target_label = "hostname" - } - rule { + rule { action = "replace" source_label = "__host__" target_label = "hostname" } - rule { - action = "replace" - target_label = "hostname" - replacement = "${env.HOSTNAME}" - } - rule { + rule { action = "replace" source_label = "${env.HOSTNAME}" target_label = "hostname"