Promtail drop certain logs

Hello, team!
I would like to find way to drop certain logs. Is there any example how to do that?

Thank you so much in an advance!

Hi,

You can use pipeline stages to filter, refer to this documentation:

match

The match stage conditionally executes a set of stages when a log entry matches a configurable LogQL stream selector.

Hope it helps.

Good Luck

Thank you! I will take a look at it!

I have the same question as well.
here is what I am trying to do.

  snippets:
    pipelineStages:
      - cri: {}
      - match:
          selector: '{app_kubernetes_io_name="ingress-nginx"}'
          action: drop
      - labels:
          cluster: rancher

However, this doesn’t really work because the selector doesn’t catch anything

The label is like app.kubernetes.io/name: ingress-nginx

What is the correct syntax to do this?

I have tried __meta_kubernetes_pod_label_app_kubernetes_io_name and it doesn’t work either.

Thx