1

I am using loki-stack helm chart I am doing following configuration to disable kube-system namespace logs in promtail so that loki doesnt use it

promtail:
  enabled: true
  #
  # Enable Promtail service monitoring
  # serviceMonitor:
  #   enabled: true
  #
  # User defined pipeline stages
  pipelineStages:
    - docker: {}
    - drop:
        source: namespace
        expression: "kube-.*"

Please help in solving inside container this values are not getting updated

The configuration is already mentioned above

shreysway
  • 11
  • 2

1 Answers1

1

I had the same issue with this configuration and it seems like the pipelineStages at this level is being ignored. I solved my problem by moving it to snippets.

promtail:
  enabled: true
  config:
    snippets:
      pipelineStages:
        - docker: {}
        - drop:
            source: namespace
            expression: "kube-.*"

This worked for me and I hope it helps someone else who might run into the same problem. For more details, please check out this link: https://github.com/grafana/helm-charts/blob/main/charts/promtail/values.yaml

OMARoun
  • 23
  • 4
  • Thanks a lot mate !. But can you help in dropping logs from loki its not collecting logs but pld logs been seen in loki. can I remove that namespace with any query or any sort of API? – shreysway Feb 18 '23 at 05:29
  • You could try using the API provided by Grafana to drop logs from Loki: https://grafana.com/docs/grafana-cloud/data-configuration/logs/delete-log-lines/ – OMARoun Feb 19 '23 at 12:26
  • hello could you give me loki-stack values to enable retention period of 7 days? – shreysway Feb 28 '23 at 12:17