Closed Lavanya2102 closed 1 year ago
@Lavanya2102 please test the binary in PR #13660 and let me know if this fixes your problem with the following config
metric_name = "'cpu_partitions'"
metric_selection = "/cpu_partitions/*"
field_selection = "*"
PR #13660 allows to fill fields with complex type with their native JSON representation. However, this field is still a string as Telegraf does not have structured field types. If you need to reconstruct the arrays on the output as JSON you should use field_name_expansion = true
and resemble the arrays by a JSONata transformation...
json_transformation = '''
{
"tags": tags,
"name": name,
"timestamp": timestamp,
"fields": $merge(
[
$sift(fields, function($v, $k) {
$not($match($k, /nodelist_/))
}),
{
"nodelist": $each(
$sift(fields, function($v, $k) {$match($k, /nodelist_/)}),
function($v, $k) {
$v
}
)
}
]
)
}
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.28
Docker
No response
Steps to reproduce
Expected behavior
Actual behavior
Additional info
No response