revert hostname label

This commit is contained in:
Arne Teuke
2025-03-11 14:09:35 +01:00
parent 1faeda700b
commit bec3125184

View File

@@ -31,6 +31,12 @@ loki.process "parse_hostname" {
}
}
}
// Fallback: Set hostname explicitly if not parsed
stage.static_labels {
values = {
hostname_fallback = system.hostname, // e.g., fm002
}
}
}
// Refine labels
@@ -50,11 +56,11 @@ loki.relabel "add_labels" {
source_labels = ["hostname"]
target_label = "hostname"
}
//rule {
// source_labels = ["hostname_fallback"]
// target_label = "hostname"
// action = "replace"
// replacement = "${__label:hostname_fallback}" // Only if hostname is unset
rule {
source_labels = ["hostname_fallback"]
target_label = "hostname"
action = "replace"
replacement = "${__label:hostname_fallback}" // Only if hostname is unset
}
}