Relabeling Rule Fields

Relabeling rules generally have the following configuration fields, but for each type of action (relabeling rule type), only a subset of these fields are used:

  • action: The desired relabeling action to execute (replace, keep, drop, hashmod, labelmap, labeldrop, or labelkeep). Defaults to replace.
  • source_labels: A list of label names that are concatenated using the configured separator string and matched against the provided regular expression.
  • separator: A string with which to separate source labels when concatenating them. Defaults to ";".
  • target_label: The name of the label that should be overwritten when using the replace or hashmod relabel actions.
  • regex: The regular expression to match against the concatenated source labels. Defaults to "(.*)" to match any source labels.
  • modulus: The modulus to take of the hash of the concatenated source labels. Useful for horizontal sharding of Prometheus setups.
  • replacement: A replacement string that is written to the target_label label for replace relabel actions. It can refer to regular expression capture groups that were captured by regex.