You mean you're seeing tag_owner, tag_Owner, tag_OWNER from different 
instances? Because the tags weren't entered consistently?

I don't see a lowercasing version of the "labelmap" action. So I think 
you're back to either:

1. fixing the data at source (e.g. using the EC2 API to read the tags and 
reset them to the desired values; and then make policies and procedures so 
that new instances have consistent tag names); or
2. proxying / modifying the exporter

> I think  lower/upper action in relabeling works to make "*values*" of 
labels to lower/upper 

I believe so. The way I interpret it, "lowercase" action is the same as 
"replace", but the concatenated values from source_labels are lowercased 
first. Hence the fixed target_label that you specify will get the 
lowercased value, after any regex matching/capturing.

The test case here agrees:
https://github.com/prometheus/prometheus/blob/v2.45.4/model/relabel/relabel_test.go#L461-L482

On Thursday 18 April 2024 at 11:47:16 UTC+1 Vaibhav Ingulkar wrote:

> Additionally , I have prepare below config under metric_relable_configs
> - action: labelmap
>   regex: 'tag_(.*)'
>   replacement: $1
>
> It is giving one me new set of all label starting with word '*tag_*' as 
> added in regex but not converting them to lowercase and removing "*tag_*" 
> from label name, for ex. *tag_Name* is converted only "N*ame*"
> Also existing label *tag_Name* is also remaining as it is .i.e. old label 
> *tag_Name* and new label *Name*
>
> So Firstly I want that "*tag_"* should remain as it it in new label and 
> it should get converted to lower case i.e. for ex. *tag_Budget_Code* to 
> *tag_budget_code* or *tag_Name* to *tag_name*
> Secondly need to remove old label for ex. *tag_Budget_Code* , *tag_Name* , 
> etc
>
> On Thursday, April 18, 2024 at 3:46:57 PM UTC+5:30 Vaibhav Ingulkar wrote:
>
>> Thanks @Brian Kochie
>>
>> Correct me if I am wrong but I think  lower/upper action in relabeling 
>> works to make "*values*" of labels to lower/upper and not "*keys*" *i.e. 
>> label name itself wont get convert to lowercase*. Right?
>>
>> Because I an using *v2.41.0 *and  have tried it and it is converting all 
>> values of labels to lowercase.
>>
>> Here my requirement is to convert labels i.e. keys to lowercase for ex. 
>> *tag_Budget_Code* to *tag_budget_code* or *tag_Name* to *tag_name*
>>
>> On Thursday, April 18, 2024 at 2:26:10 PM UTC+5:30 Brian Candler wrote:
>>
>>> On Thursday 18 April 2024 at 09:42:41 UTC+1 Ben Kochie wrote:
>>>
>>> Prometheus can lower/upper in relabeling.
>>>
>>>
>>> Thanks! That was added in v2.36.0 
>>> <https://github.com/prometheus/prometheus/releases/v2.36.0>, and I 
>>> missed it.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/bb7045b4-eeaf-404a-8aaf-affeae3bcf95n%40googlegroups.com.

Reply via email to