Skip to content

Commit 7786aca

Browse files
authored
fix(cockpit): added extraDiscoveryRules
1 parent fe15699 commit 7786aca

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 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,10 @@ alloy-logs:
7379
alloy-singleton:
7480
enabled: true
7581
```
82+
<Message type="tip">
83+
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.
84+
If you want to exlude other pods, you can add an extra drop rule in the extraDiscoveryRules section.
85+
</Message>
7686

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

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

0 commit comments

Comments
 (0)