Logs Relabel Rules
Logs don’t use the ingester relabel rules described in How Relabel Rules Work. The ingester has no relabelConfigs key for logs. Instead, logs are relabeled by the relabel function in the logs-parser pipeline, which you configure under logs-parser.kf_parsing_config in your Helm values. The full reference is in Log Parsing Configuration: Relabel.
How log relabel rules differ
| Metrics, traces, events, and RUM | Logs | |
|---|---|---|
Where rules are configured |
|
A |
Format |
Prometheus |
The logs-parser’s own |
Actions |
|
|
Assigning a retention policy |
The |
Set the reserved |
Log relabel rules can match on labels (prefixed # or bare) and on facets (prefixed @). relabel always runs before facets are extracted, so it can’t see a facet that grammar (parser) or JSON auto-parsing produces. To act on an extracted facet, use transform instead. See Relabel, Transform priority order.
Common tasks
Each of these is configured in Log Parsing:
-
Add or rewrite a label: use the
replaceaction. See Actions. -
Drop log lines: use the
droporkeepaction. See Actions. -
Remove or rename labels: use the
label_drop,label_keep, orlabel_mapaction. See Actions. -
Promote a facet to a label: use the
facet_to_label_mapaction in atransformstep for facets extracted by parsing. See Transform and fingerprinting. -
Assign logs to a retention policy: set
__kf_retention. See Logs Stream. -
Apply a rule only to some logs: add conditions to the
relabelstep. See Functions and conditions.
Next steps
-
Log Parsing Configuration — configure the logs-parser pipeline, including
relabel -
Log Parsing Best Practices — guidance for writing parsing and relabel rules
-
Log Parsing Troubleshooting — check that a rule does what you expect