Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass hostname through a trim filter before shipping #27

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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