Hi there! We use Grafana Alloy for Loki to gather all logs to push to a centralized Loki server. We wish to add the server hostname as a label. We’ve tried the following, but it doesn’t seem to work, and cannot find the right resources on how to set this up. Any tips?
loki.relabel "journal" {
forward_to = []
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}
rule {
source_labels = ["__hostname__"]
target_label = "hostname"
}
}
loki.source.journal "read" {
forward_to = [loki.process.filter_logs.receiver]
relabel_rules = loki.relabel.journal.rules
labels = {component = "loki.source.journal"}
}