How Relabel Rules Work
Relabel rules let you rewrite, add, and remove labels on incoming data, drop data you do not want to store, and assign data to a retention policy, before Kloudfuse stores it. The rules run in the ingester and use the Prometheus relabel_config format.
Each stream has its own list of rules. Logs are covered in the logs-parser pipeline. It has its own relabel and transform functions; see Logs Relabel Rules.
Where to configure rules
Add each stream’s rules to its relabelConfigs list under ingester.config in your custom-values.yaml file:
| Stream | Helm values key |
|---|---|
|
|
|
|
|
|
|
All lists are empty by default. Rules for one stream never apply to another.
To apply a change, run a Helm upgrade:
helm upgrade --install kfuse oci://us-east1-docker.pkg.dev/mvp-demo-301906/kfuse-helm/kfuse \
-n kfuse \
--version <VERSION> \ (1)
-f custom-values.yaml
| 1 | Replace <VERSION> with a valid Kloudfuse release value. See Release Notes for the latest release. |
Rule fields
| Field | Description |
|---|---|
|
The labels whose values the rule reads. Their values are joined with |
|
The string placed between the |
|
A regular expression matched against the joined value, or against label names for |
|
The label that |
|
The value written to |
|
The modulus for |
|
The retention policy that the |
|
What the rule does. Default: |
Actions
| Action | What it does |
|---|---|
|
If |
|
Writes the joined |
|
Hashes the joined |
|
For every label whose name matches |
|
Removes every label whose name matches |
|
Removes every label whose name does not match |
|
Drops the data point if |
|
Drops the data point if |
|
If |
The ingester skips rules with any other action and logs a warning. The Prometheus keepequal and dropequal actions are not supported.
How rules are evaluated
-
Rules run in order. Each rule sees the labels as the previous rules left them, so a rule can match a label that an earlier rule added or changed.
-
A drop ends evaluation. When a
droporkeeprule drops a data point, the remaining rules do not run. -
The last matching
retentionrule wins. If severalretentionrules match, the data point gets the policy of the last one. -
Ingestion API key labels are protected. If the data was sent with an ingestion API key that adds labels, rules can match those labels but cannot change or remove them.
What happens after relabeling
Relabel rules run before the rest of ingestion, so everything later sees the relabeled data:
-
Rate control class matchers match the relabeled labels, and dropped data never counts against a rate control limit.
-
Consumption tracking counts the data as received, then counts data dropped by a rule with the drop reason
relabel. -
Consumption tracking labels are read from the relabeled labels.
Stream pages
-
Logs Relabel Rules — logs are relabeled in the log parsing pipeline, not by these rules