Skip to content

Commit 0332b57

Browse files
authored
fix(cockpit): added extraDiscoveryRules (#5788)
1 parent d33c62f commit 0332b57

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ podLogs:
6363
destinations: ["my-cockpit-logs"]
6464
volumeGatherSettings:
6565
onlyGatherNewLogLines: true
66-
66+
# Prevent collecting the collector own logs
67+
extraDiscoveryRules: |
68+
rule {
69+
source_labels = ["__meta_kubernetes_pod_name"]
70+
action = "drop"
71+
regex = ".*alloy-logs.*"
72+
}
6773
# An Alloy instance for collecting log data.
6874
alloy-logs:
6975
enabled: true
@@ -73,6 +79,12 @@ alloy-logs:
7379
alloy-singleton:
7480
enabled: true
7581
```
82+
<Message type="tip">
83+
The `PodLogs` feature automatically discovers and collects logs from all pods.
84+
In the configuration above, we excluded the logs from the pod responsible for log collection itself.
85+
86+
If you want to exclude additional pods, you can add more drop rules in the `extraDiscoveryRules` section.
87+
</Message>
7688

7789
<Message type="note">
7890
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
146158
7. Optionally, click the **Clock** icon on the top right corner of your screen and filter by time range.
147159
8. Click **Run query** to see your logs. An output similar to the following should display.
148160

149-
<Lightbox image={image} alt="" />
161+
<Lightbox image={image} alt="" />

0 commit comments

Comments
 (0)