From 7786acadec12bf83bddd3352d2c0e452750d1fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Le=20Blay?= Date: Wed, 12 Nov 2025 14:21:22 +0100 Subject: [PATCH 1/2] fix(cockpit): added extraDiscoveryRules --- .../how-to/send-logs-from-k8s-to-cockpit.mdx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx b/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx index 5aa55646b3..32eeee8294 100644 --- a/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx +++ b/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx @@ -63,7 +63,13 @@ podLogs: destinations: ["my-cockpit-logs"] volumeGatherSettings: onlyGatherNewLogLines: true - + # Prevent collecting the collector own logs + extraDiscoveryRules: | + rule { + source_labels = ["__meta_kubernetes_pod_name"] + action = "drop" + regex = ".*alloy-logs.*" + } # An Alloy instance for collecting log data. alloy-logs: enabled: true @@ -73,6 +79,10 @@ alloy-logs: alloy-singleton: enabled: true ``` + + The `PodLogs` feature will do the autodiscovery to collect logs from all pods. In the above configuration, we have dropped all the logs of the pod in charge of collecting the logs. + If you want to exlude other pods, you can add an extra drop rule in the extraDiscoveryRules section. + The template above is for sending logs to your Cockpit. You can also configure it to send metrics to Cockpit using this Helm chart. @@ -146,4 +156,4 @@ You can also use Terraform/OpenTofu to manage and deploy Helm charts, providing 7. Optionally, click the **Clock** icon on the top right corner of your screen and filter by time range. 8. Click **Run query** to see your logs. An output similar to the following should display. - \ No newline at end of file + From 5cb19a597c5128264a223dfb8c3a8c61302cd49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9da?= <87707325+nerda-codes@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:55:34 +0100 Subject: [PATCH 2/2] Update pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx --- pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx b/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx index 32eeee8294..7f98d83f0c 100644 --- a/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx +++ b/pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx @@ -80,8 +80,10 @@ alloy-singleton: enabled: true ``` - The `PodLogs` feature will do the autodiscovery to collect logs from all pods. In the above configuration, we have dropped all the logs of the pod in charge of collecting the logs. - If you want to exlude other pods, you can add an extra drop rule in the extraDiscoveryRules section. + The `PodLogs` feature automatically discovers and collects logs from all pods. +In the configuration above, we excluded the logs from the pod responsible for log collection itself. + +If you want to exclude additional pods, you can add more drop rules in the `extraDiscoveryRules` section.