Collecting Kubernetes Pod Logs

SigNoz enables seamless collection of Kubernetes pod logs, allowing you to perform various actions on the data.

Setup

To collect logs from your Kubernetes cluster in SigNoz Cloud, deploy the k8s-infra chart by following this guide.

📝 Note

Log collection of pods from all namespaces is enabled by default except for kube-system, hotrod and locust.

Customizing Kubernetes Pod Logs Collection

Disable Automatic Pod Logs Collection

  1. Modify/Create override-values.yaml file with the below configuration to customize and override default settings of the values.yaml file:
presets:
  logsCollection:
    enabled: false

The presets key in the k8s-infra chart includes logsCollection, which controls log collection, and setting enabled: false disables automatic pod log collection.

  1. Apply the configuration:

Run the below command in the directory containing the override-values.yaml file.

helm -n platform upgrade --install <release-name> signoz/k8s-infra -f override-values.yaml

<release-name>: Replace this placeholder with your helm release name (e.g., my-monitoring).

Exclude/Include/Filter Logs Collection

To exclude logs based on namespaces, pods, or containers, you need to modify/create override-values.yaml file with the below configuration to customize and override default settings of the values.yaml file:

presets:
  logsCollection:
    # whether to enable log collection
    enabled: true
    blacklist:
      # whether to enable blacklisting
      enabled: true
      # whether to exclude signoz logs
      signozLogs: false
      # which namespaces to exclude
      namespaces:
        - kube-system
      # which pods to exclude
      pods:
        - hotrod
        - locust
      # which containers to exclude
      containers: []
      # additional exclude rules
      additionalExclude: []

The presets key in the k8s-infra chart includes logsCollection, which controls log collection, and enabling blacklist allows exclusion of logs from specified namespaces, pods, and containers.

Run the below command in the directory containing the override-values.yaml file to apply the configuration:

helm -n platform upgrade --install <release-name> signoz/k8s-infra -f override-values.yaml

<release-name>: Replace this placeholder with your helm release name (e.g., my-monitoring).

After making changes to the configuration, restart the OpenTelemetry Collector pod deployed by the k8s-infra chart to apply the updates.

Was this page helpful?