grafana/k8s-monitoring-helm

How to customize tag extraction for loki logs?

domma opened this issue · 1 comments

I have a working setup based on this Helm chart. I need to adapt and add some loki.processing blocks to extract Loki tags from our jsonl formatted logs. There is an automatically generated k8s-monitoring-alloy-logs config map. I was able to extract the generated default configuration, to change it and to update the configmap with my version. Everything works fine.

But that process is obviously only for testing. For production I need to customize the log configuration when installing the chart, but I could not figure out how to do that. I tried to read the code, but got lost somewhere between the main chart and the alloy chart.

Could somebody tell me how to customize the Alloy log configuration when installing the chart?

Have you looked at the extraRelabelingRules and extraStageBlocks sections for logs as in this example?
https://github.com/grafana/k8s-monitoring-helm/tree/main/examples/extra-rules

extraStageBlocks go into the loki.process component and affects all of the logs gathered by alloy-logs.