Report this

What is the reason for this report?

Where Are The Configuration Files For Adding Labels to Grafana Loki Stack

Posted on July 20, 2020

I already setup Grafana Loki stack on my Kubernetes. How to add label parser configuration like in this example https://github.com/grafana/loki/blob/master/docs/getting-started/labels.md ?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

To add a label parser configuration to your Loki stack in Kubernetes, you will need to manually update your Loki configuration. This is typically located in a ConfigMap that is then mounted as a volume to your Loki pod.

The label configuration is done within the scrape_configs section of your Loki configuration, as follows:

html **scrape_configs**: - **job_name**: system **static_configs**: - **targets**: - localhost **labels**: **job**: varlogs **__path__**: /var/log/*log_ 

Replace the job_name and targets as necessary in your environment. Additionally, after making any changes, ensure to reload or restart your Loki instance for the new settings to take effect.

For more detailed information, you may refer to the official Grafana documentation.

Remember, the exact implementation might vary depending on how you have deployed your Kubernetes and Loki stack.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.