-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add relabeling rules to pod logs (#22)
Signed-off-by: Pete Wall <[email protected]>
- Loading branch information
Showing
8 changed files
with
156 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ name: k8s-monitoring | |
description: A Helm chart for gathering, scraping, and forwarding Kubernetes infrastructure metrics and logs to a Grafana Stack. | ||
type: application | ||
|
||
version: 0.0.6 | ||
appVersion: 1.1.5 | ||
version: 0.0.7 | ||
appVersion: 1.1.6 | ||
icon: https://raw.githubusercontent.com/grafana/grafana/main/public/img/grafana_icon.svg | ||
maintainers: | ||
- email: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 31 additions & 3 deletions
34
charts/k8s-monitoring/templates/agent_config/_pod_logs.river.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,45 @@ | ||
{{ define "agent.config.logs.pod_logs" }} | ||
// Pod Logs | ||
discovery.relabel "pod_logs" { | ||
targets = discovery.kubernetes.pods.targets | ||
|
||
rule { | ||
source_labels = ["__meta_kubernetes_namespace"] | ||
action = "replace" | ||
target_label = "namespace" | ||
} | ||
rule { | ||
source_labels = ["__meta_kubernetes_pod_name"] | ||
action = "replace" | ||
target_label = "pod" | ||
} | ||
rule { | ||
source_labels = ["__meta_kubernetes_pod_container_name"] | ||
action = "replace" | ||
target_label = "container" | ||
} | ||
rule { | ||
source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_name"] | ||
separator = "/" | ||
action = "replace" | ||
replacement = "$1" | ||
target_label = "job" | ||
} | ||
} | ||
|
||
loki.source.kubernetes "pod_logs" { | ||
targets = discovery.kubernetes.pods.targets | ||
targets = discovery.relabel.pod_logs.output | ||
forward_to = [loki.process.pod_logs.receiver] | ||
} | ||
|
||
loki.process "pod_logs" { | ||
stage.static_labels { | ||
values = { | ||
job = "integration/kubernetes/pod_logs", | ||
cluster = local.file.cluster_name.content, | ||
} | ||
} | ||
|
||
stage.{{- .Values.logs.pod_logs.loggingFormat }} {} | ||
forward_to = [loki.process.add_cluster_label.receiver] | ||
forward_to = [loki.write.grafana_cloud_loki.receiver] | ||
} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters