- Documentation
- Learning Hub
- Section 4 of 5 Apply labeling strategy to logs
The decision framework
Slide 3 of 5
The decision framework
For any piece of log data, ask where it belongs.
- If you filter by it in almost every query, and it’s bounded, make it a label. Example:
env,app. - It’s high-cardinality but you query it often, attach it as structured metadata. It’s queryable with a label filter expression, such as
{job="example"} | pod="myservice-abc1234-56789", without being indexed or creating streams. Examples: pod names, process IDs, trace IDs. - Everything else, leave it in the log line and extract it at query time with parsers like
jsonorlogfmt, or search it with filter expressions.