journal hostname label

This commit is contained in:
Arne Teuke
2025-03-11 16:26:21 +01:00
parent f8a400253d
commit 4a0551cf30

View File

@@ -20,7 +20,7 @@ loki.process "extract_hostname" {
"hostname" = "hostname", // Assigns extracted hostname to the label
}
}
forward_to = [loki.write.loki.receiver]
forward_to = [loki.relabel.add_labels.receiver]
}
@@ -42,13 +42,18 @@ loki.source.file "system_logs" {
// Relabel logs to add hostname and job labels
loki.relabel "add_labels" {
forward_to = [loki.write.loki.receiver]
rule {
action = "replace"
target_label = "host"
replacement = "hostname"
}
rule {
action = "replace"
target_label = "job"
replacement = "syslogs"
}
forward_to = [loki.write.loki.receiver]
}
loki.write "loki" {