From 56e249023a9dbdca8850d4527b5ce41698891ffd Mon Sep 17 00:00:00 2001 From: Tyler Witlin <45468117+coolguy1771@users.noreply.github.com> Date: Sat, 14 Dec 2024 12:08:54 -0500 Subject: [PATCH] fix(kyka): more logging configs Signed-off-by: Tyler Witlin <45468117+coolguy1771@users.noreply.github.com> --- .../app/helmrelease.yaml | 239 +++++++++++++++++- 1 file changed, 238 insertions(+), 1 deletion(-) diff --git a/kubernetes/kyak/apps/monitoring/grafana-k8s-monitoring/app/helmrelease.yaml b/kubernetes/kyak/apps/monitoring/grafana-k8s-monitoring/app/helmrelease.yaml index 3923461994..44025035a9 100644 --- a/kubernetes/kyak/apps/monitoring/grafana-k8s-monitoring/app/helmrelease.yaml +++ b/kubernetes/kyak/apps/monitoring/grafana-k8s-monitoring/app/helmrelease.yaml @@ -64,12 +64,70 @@ spec: enabled: true beyla: enabled: true + apiserver: + enabled: true + kubeControllerManager: + enabled: true + kubeScheduler: + enabled: true logs: enabled: true pod_logs: enabled: true cluster_events: enabled: true + extraConfig: |- + discovery.relabel "logs_alloy" { + targets = discovery.relabel.pod_logs.output + rule { + source_labels = ["__meta_kubernetes_pod_label_app_kubernetes_io_name"] + regex = "alloy.*" + action = "keep" + } + + rule { + source_labels = ["pod"] + target_label = "instance" + } + + rule { + target_label = "job" + replacement = "integrations/alloy" + } + } + + local.file_match "logs_alloy" { + path_targets = discovery.relabel.logs_alloy.output + } + + loki.source.file "logs_alloy" { + targets = local.file_match.logs_alloy.targets + forward_to = [loki.process.logs_alloy.receiver] + } + + loki.process "logs_alloy" { + forward_to = [loki.process.logs_service.receiver] + + stage.regex { + expression = "(level=(?P[\\s]*debug|warn|info|error))" + } + + stage.labels { + values = { + level = "log_level", + } + } + + stage.match { + selector = "{tmp_container_runtime=\"docker\"}" + stage.docker {} + } + + stage.match { + selector = "{tmp_container_runtime=\"containerd\"}" + stage.cri {} + } + } traces: enabled: true receivers: @@ -95,4 +153,183 @@ spec: alloy-events: {} alloy-logs: {} beyla: - enabled: true \ No newline at end of file + enabled: true + extraConfig: |- + discovery.relabel "cilium_agent" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_k8s_app"] + regex = "cilium" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "metrics" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_service_label_k8s_app"] + regex = "(.+)" + replacement = "${1}" + target_label = "k8s_app" + } + } + + prometheus.scrape "cilium_agent" { + targets = discovery.relabel.cilium_agent.output + job_name = "integrations/cilium-enterprise/cilium-agent" + honor_labels = true + forward_to = [prometheus.relabel.metrics_service.receiver] + } + + // Cilium Operator + discovery.relabel "cilium_operator" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_name"] + regex = "cilium-operator" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_service_label_io_cilium_app"] + regex = "operator" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "metrics" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_service_label_io_cilium_app_app"] + regex = "(.+)" + replacement = "${1}" + target_label = "io_cilium_app" + } + } + + prometheus.scrape "cilium_operator" { + targets = discovery.relabel.cilium_operator.output + job_name = "integrations/cilium-enterprise/cilium-operator" + honor_labels = true + forward_to = [prometheus.relabel.metrics_service.receiver] + } + + // Hubble Relay + discovery.relabel "hubble_relay" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_k8s_app"] + regex = "hubble-relay" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "metrics" + action = "keep" + } + } + + prometheus.scrape "hubble_relay" { + targets = discovery.relabel.hubble_relay.output + job_name = "integrations/cilium-enterprise/hubble-relay" + forward_to = [prometheus.relabel.metrics_service.receiver] + } + + // Hubble + discovery.relabel "hubble" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_k8s_app"] + regex = "hubble" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "hubble-metrics" + action = "keep" + } + } + + prometheus.scrape "hubble" { + targets = discovery.relabel.hubble.output + job_name = "integrations/cilium-enterprise/hubble" + honor_labels = true + forward_to = [prometheus.relabel.metrics_service.receiver] + } + + // Hubble Enterprise + discovery.relabel "hubble_enterprise" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_app_kubernetes_io_name"] + regex = "hubble-enterprise" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "metrics" + action = "keep" + } + } + + prometheus.scrape "hubble_enterprise" { + targets = discovery.relabel.hubble_enterprise.output + job_name = "integrations/cilium-enterprise/hubble-enterprise" + honor_labels = true + forward_to = [prometheus.relabel.metrics_service.receiver] + } + + // Hubble Timescape Ingester + discovery.relabel "hubble_timescape_ingester" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_app_kubernetes_io_name"] + regex = "hubble-timescape-ingester" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_service_label_app_kubernetes_io_component"] + regex = "ingester" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "metrics" + action = "keep" + } + } + + prometheus.scrape "hubble_timescape_ingester" { + targets = discovery.relabel.hubble_timescape_ingester.output + job_name = "integrations/cilium-enterprise/hubble-timescape-ingester" + honor_labels = true + forward_to = [prometheus.relabel.metrics_service.receiver] + } + + // Hubble Timescape Server + discovery.relabel "hubble_timescape_server" { + targets = discovery.kubernetes.services.targets + rule { + source_labels = ["__meta_kubernetes_service_label_app_kubernetes_io_name"] + regex = "hubble-timescape-server" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_service_label_app_kubernetes_io_component"] + regex = "server" + action = "keep" + } + rule { + source_labels = ["__meta_kubernetes_endpoint_port_name"] + regex = "metrics" + action = "keep" + } + } + + prometheus.scrape "hubble_timescape_server" { + targets = discovery.relabel.hubble_timescape_server.output + job_name = "integrations/cilium-enterprise/hubble-timescape-server" + honor_labels = true + forward_to = [prometheus.relabel.metrics_service.receiver] + } \ No newline at end of file