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 Enterprise Logs resources
Grafana Enterprise Logs: Logging with security and scale
Join us for this webinar, which will cover: Challenges with logging as organizations scale and the volume of logs explodes, how Grafana Enterprise Logs enables organizations to make logs available to any team members who need them, features available in GEL and how to get access, a live product demo so you can see GEL for the first time
VIDEO: Watch this first-look demo of the new Grafana Enterprise Logs
Based on Loki, Grafana Enterprise Logs is part of the Grafana Enterprise Stack for composing and scaling observability on your own infrastructure.
Introducing Grafana Enterprise Logs, a core part of the Grafana Enterprise Stack integrated observability solution
Powered by the Loki open source project, the Enterprise Logs offering joins metrics and dashboards in our enterprise-ready stack for self-managed observability.