Skip to content
Open
Changes from all commits
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
16 changes: 14 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,12 @@ alloy-logs:
alloy-singleton:
enabled: true
```
<Message type="tip">
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.
</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 +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.

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