-
Hi, I would like to transform a json in this way (I simplified a little the data for the example) : Before : {"gauge":{"value":973.0},"kind":"absolute","name":"scrape_samples_scraped","tags":{"job":"node_exporter"}} After: {"fields":{"job":"node_exporter","metric_name:scrape_samples_scraped":973.0}} I tried to do it with a remap but I don't manage to get the part with the metric_name inside the field name : "metric_name:scrape_samples_scraped":973.0 So, is there a way with vector to use a field value as, or inside a field name ? I tried to get around that by using the parse_key_value() function, but then the metric value field becomes a String, and I can't convert it to an Int because the field name will not always be the same... What I tried : .fields = merge!(del(.tags),parse_key_value!("metric_name:" + to_string!(.name) + "=" + to_string!(.gauge.value),"=")) What I got : {"fields": { "job": "node_exporter", "metric_name:scrape_samples_scraped": "973" }} Please tell me if you have any idea, Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @AdAndre ! It does appear like this isn't quite possible yet. I thought something like:
Might work, but it didn't. I think this is related partially related to #7050 , but a bit different. I'll convert this discussion into an issue for tracking. |
Beta Was this translation helpful? Give feedback.
Hi @AdAndre !
It does appear like this isn't quite possible yet. I thought something like:
Might work, but it didn't. I think this is related partially related to #7050 , but a bit different. I'll convert this discussion into an issue for tracking.