Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pages/cockpit/how-to/send-logs-from-k8s-to-cockpit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -73,6 +79,10 @@ alloy-logs:
alloy-singleton:
enabled: true
```
<Message type="tip">
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.
</Message>

<Message type="note">
The template above is for sending logs to your Cockpit. You can also configure it to send metrics to Cockpit using this Helm chart.
Expand Down Expand Up @@ -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.

<Lightbox image={image} alt="" />
<Lightbox image={image} alt="" />