Configuration of Relabel Rules

The Kloudfuse platform supports rewriting the labels of Metrics, Events, Logs, Traces data at ingest. The relabel configuration follows Prometheus relabel config format and can be configured through the helm chart values. Add the corresponding relabel_configs section in the custom_values.yaml as follows.

ingester: config: aggregator: metric: # relabelConfigs - Configure relabel rules for metric labels. # Format follows Prometheus relabel_config syntax. # Ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config relabelConfigs: [] events: # relabelConfigs - Configure relabel rules for events labels. # Format follows Prometheus relabel_config syntax. # Ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config relabelConfigs: [] traces: # relabelConfigs - Configure relabel rules for traces labels. # Format follows Prometheus relabel_config syntax. # Ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config relabelConfigs: []

Examples

Case 1: Add new labels based on current label value

It is a common scenario where you may want to enrich some metrics with new labels depending on the existing label values. For example, for the label aws_account with value 123456 you need to add aws_account_name label with AWS_account_name_for_123456 value. To do so add following section in custom_values.yaml. Make sure to append to existing values.

ingester: config: aggregator: metric: # relabelConfigs - Configure relabel rules for metric labels. # Format follows Prometheus relabel_config syntax. # Ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config relabelConfigs: - ... - regex: "123456" replacement: AWS_account_name_for_123456 source_labels: - aws_account target_label: aws_account_name - ...
  • Restart ingester

kubectl rollout restart statefulset ingester

Case 2: Drop (or Keep) series with matching label values

In scenarios where certain series have to be dropped depending on the existing label values. For example, if you do not want to store data for the label aws_account with value 123456 you need to add aws_account_name label with AWS_account_name_for_123456 value in the relabel config. This is done by using the drop action. If you are looking to only keep certain series, then use keep action instead of drop. See example below in custom_values.yaml. Make sure to append to existing values.

  • Restart ingester