The labels stage is an action stage that takes data from the extracted map and modifies the label set that is sent to Loki with the log entry.
labels: # Key is REQUIRED and the name for the label that will be created. # Value is optional and will be the name from extracted data whose value # will be used for the value of the label. If empty, the value will be # inferred to be the same as the key. [ <string>: [<string>] ... ]
For the given pipeline:
- json: expressions: stream: stream - labels: stream:
Given the following log line:
The first stage would extract
stream into the extracted map with a value of
stderr. The labels stage would turn that key-value pair into a label, so the
log line sent to Loki would include the label
stream with a value of
Related Loki resources
Be the first to learn about exciting next-generation features in Grafana 8.0, be inspired by what community members are building, and attend expert-led sessions and workshops on Grafana, Prometheus, Loki logs, and more.
Logging with Loki: Essential configuration settings
This webinar focuses on Loki configuration, picking up where we left off at the end of the Intro to Loki webinar.