we’re using Loki and Promtail on Azure on AKS. We install/update and manage them through helm, so far we didn’t really do changes in the configuration files but now we would like to drop some of the messages from our ingress nginx controller (messages coming to two specific endpoints from on-premise services).
I have tried to modify the values.yaml but unfortunately although the config is picked up and appears in the promtail.yaml file on promtail’s pods it doesn’t actually does what we expected.
Could you help me figure out what did we miss in the config?
The goal is: drop all lines that are coming from app: ingress-nginx and contains the string “/getdate”
Sure, this is the promtail config that is currently on the pods (I removed the default kubernetes part as it’s long, but let me know if I should put it back in):
root@promtail-txxtq:/# cat /etc/promtail/promtail.yaml
server:
log_level: info
http_listen_port: 3101
clients:
- url: http://loki-gateway/loki/api/v1/push
positions:
filename: /run/promtail/positions.yaml
scrape_configs:
# See also https://github.com/grafana/loki/blob/master/production/ksonnet/promtail/scrape_config.libsonnet for reference
- job_name: kubernetes-pods
... the default kubernetes related settings here ...
- job_name: nginx-getdate-lines
pipeline_stages:
- match:
selector: '{job="ingress/ingress-nginx"}'
stages:
- drop:
expression: .*\/getdate.*
limits_config:
thanks for checking, based on this I think the selector might be wrong that we use as the regex seems to work as expected in your example.
This selector is used when we query for the log lines on grafana with loki. Not sure if this is usable as is in promtail, maybe I have to separate the namespace or do some label conversion first?
The labels look correct. I want to backtrack to your configuration above:
- job_name: kubernetes-pods
... the default kubernetes related settings here ...
- job_name: nginx-getdate-lines
...
What’s happening under the job_name: kubernetes-pods block? Is it possible that the ingress logs are picked up there? If so, then your nginx-getdate-lines would’ve never been invoked and would explain why the drop isn’t being processed.
This is the whole file without the reduction (I removed that part as it gets there from the standard helm config I assume and we haven’t changed it’s values). By the look of it it’s mostly about the renaming of the labels:
I’ve not used promtail with kubernetes much, so I could be wrong, but what happens if you try to move your pipeline stage from job_name: nginx-getdate-lines into the first pipeline stages?