From f1dffc7fb161ca36d935fd48a4536714cdee1c84 Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Mon, 10 Mar 2025 23:15:54 +0100 Subject: [PATCH] add file control for main log files --- templates/config.alloy.erb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/config.alloy.erb b/templates/config.alloy.erb index 18b5ea2..bd6a799 100644 --- a/templates/config.alloy.erb +++ b/templates/config.alloy.erb @@ -16,6 +16,16 @@ loki.source.file "system_logs" { forward_to = [loki.relabel.add_labels.receiver] } +// Add hostname as a label explicitly +loki.process "add_hostname" { + forward_to = [loki.relabel.add_labels.receiver] + stage.static_labels { + values = { + hostname = env("HOSTNAME", "unknown-host"), // Pulls from $HOSTNAME, defaults to "unknown-host" + } + } +} + // Add hostname and job labels loki.relabel "add_labels" { forward_to = [loki.write.loki.receiver]