add hostname label

This commit is contained in:
Arne Teuke
2025-03-11 14:49:30 +01:00
parent 77388a6d8c
commit 8ff5fbfa61

View File

@@ -20,22 +20,12 @@ loki.source.file "system_logs" {
loki.relabel "add_labels" { loki.relabel "add_labels" {
forward_to = [loki.write.loki.receiver] forward_to = [loki.write.loki.receiver]
rule { rule {
action = "replace"
source_labels = ["__host__"]
target_label = "hostname"
}
rule {
action = "replace" action = "replace"
source_label = "__host__" source_label = "__host__"
target_label = "hostname" target_label = "hostname"
} }
rule { rule {
action = "replace"
target_label = "hostname"
replacement = "${env.HOSTNAME}"
}
rule {
action = "replace" action = "replace"
source_label = "${env.HOSTNAME}" source_label = "${env.HOSTNAME}"
target_label = "hostname" target_label = "hostname"