Prometheus 重新標簽
允許在采集之前對任何目標及其標簽進行修改
• 重命名標簽名
• 刪除標簽
• 過濾目標
action:重新標簽動作
- replace:默認,通過regex匹配source_label的值,使用replacement來引用表達式匹配的分組
- keep:刪除regex與連接不匹配的目標 source_labels
- drop:刪除regex與連接匹配的目標 source_labels
- labeldrop:刪除regex匹配的標簽
- labelkeep:刪除regex不匹配的標簽
- hashmod:設置target_label為modulus連接的哈希值source_labels
- labelmap:匹配regex所有標簽名稱。然后復制匹配標簽的值進行分組,replacement分組引用(${1},${2},…)替代
relabel_configs
relable_configs: # 源標簽 [ source_labels: '[' <labelname> [, ...] ']' ] # 多個源標簽時連接的分隔符 [ separator: <string> | default = ; ] # 重新標記的標簽 [ target_label: <labelname> ] # 整則表達式匹配源標簽的值 [ regex: <regex> | default = (.*) ] # 用的少,占時略 [ modulus: <uint64> ] # 替換正則表達式匹配的分組,分組引用 $1,$2,$3,.... [ replacement: <string> | default = $1 ] # 基於正則表達式匹配執行的操作 [ action: <relabel_action> | default = replace ]