Skip to content

Commit

Permalink
fix: pass hostname through a trim filter before shipping (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjydev authored Jun 21, 2024
1 parent 0aa1dd3 commit b70a120
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
2 changes: 1 addition & 1 deletion modules/mixins/alloy-forwarder/config.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ prometheus.relabel "instance" {
forward_to = [grafana_cloud.stack.receivers.metrics]
rule {
target_label = "instance"
replacement = local.file.hostname.content
replacement = trim_space(local.file.hostname.content)
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/mixins/alloy/base.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ loki.relabel "omnibus" {

rule {
target_label = "instance"
replacement = local.file.hostname.content
replacement = trim_space(local.file.hostname.content)
}

rule {
Expand Down
27 changes: 1 addition & 26 deletions modules/mixins/alloy/config.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,6 @@ otelcol.receiver.loki "default" {
}
}

// Extract Systemd unit from journal entry
loki.relabel "journal" {
forward_to = []

rule {
target_label = "instance"
replacement = local.file.hostname.content
}

rule {
source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}

rule {
source_labels = ["__journal__boot_id"]
target_label = "boot_id"
}

rule {
source_labels = ["__journal__transport"]
target_label = "transport"
}
}

// Fetch journal entries
loki.source.journal "journal" {
forward_to = [otelcol.receiver.loki.default.receiver]
Expand All @@ -64,7 +39,7 @@ prometheus.relabel "instance" {
forward_to = [otelcol.receiver.prometheus.default.receiver]
rule {
target_label = "instance"
replacement = local.file.hostname.content
replacement = trim_space(local.file.hostname.content)
}
}

Expand Down

0 comments on commit b70a120

Please sign in to comment.