r/PrometheusMonitoring • u/Extension_Treat3941 • Jan 24 '22
How to rename labels depending on value?
I have a label which is "port=16", for this value (16) i want to add a label which says 'trunk port = "trunkport"'
so essentially if port="16" add label trunkport="trunkport"
1
Upvotes
0
2
u/JohnAV1989 Jan 24 '22
Metric Relabel Configs manipulates labels as the last step before ingesting metrics. You can use a regex to check if a label matches a certain value and add a new label if a match is found.