Adding extra scraper jobs to promtail deployed with loki helm chart

hi everyone,

i am really having hard time to add extra jobs in promtail deployed with help of helm chart grafana/loki-stack.

i have tried to copy the values file from the helm chart

cp -p loki-stack/charts/promtail/values.yaml $OLDPWD/values_promtail_nginx_or.yaml

then added following conf to it:

- job_name: nginx
  - targets:
      - localhost
      app: nginx
      env: production
      host: ruan-prod-nginx
      __path__: /var/log/nginx/*.log
  - match:
      selector: '{app="nginx"}'
      - regex:
          # logline example: - - [21/Apr/2020:13:59:45 +0000] "GET /?foo=bar HTTP/1.1" 200 612 "" "curl/7.58.0"
          expression: '^(?P<host>[\w\.]+) - (?P<user>[^ ]*) \[(?P<timestamp>.*)\] "(?P<method>[^ ]*) (?P<request_url>[^ ]*) (?P<request_http_protocol>[^ ]*)" (?P<status>[\d]+) (?P<bytes_out>[\d]+) "(?P<http_referer>[^"]*)" "(?P<user_agent>[^"]*)"?'
      - labels:

then tried to upgrade the helm chart:

helm upgrade loki grafana/loki-stack --set resources.requests.cpu=100m --set resources.requests.memory=256Mi -f values_promtail_nginx_or.yaml

then deleted my promtail pods

kubectl delete pods -l so they get re-deployed using the new config from values_promtail_nginx_or.yaml file.

however when i go to my promtail pod, the promtail.yaml conf is still the original one which came with initial deployment of loki helm chart.

I’m seeking guidance on how to update the promtail.yaml configuration file to parse nginx logs. My goal is to break down these logs into multiple fields, which will enable me to construct Grafana dashboards based on the values of these fields. Any assistance with this process would be greatly appreciated.

THanks in advance