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..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 @@ -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,12 @@ alloy-logs: alloy-singleton: enabled: true ``` + + 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. + 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 +158,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 +