I am trying to get the ec2Tag_FQDN and processDisplayName fields from this JSON output and add them to my metric as tags, however the keys are stored in the metadata array and only the values are in the results array
{
"data": {
"actor": {
"account": {
"nrql": {
"metadata": {
"eventTypes": [
"ProcessSample"
],
"facets": [
"ec2Tag_FQDN",
"processDisplayName"
]
},
"results": [
{
"facet": [
"inf-138df57e6",
"c-icap"
],
"latest.threadCount": 12
},
{
"facet": [
"inf-94ba037a2",
"c-icap"
],
"latest.threadCount": 12
},
{
"facet": [
"inf-138df57e6",
"clamd@scan"
],
"latest.threadCount": 3
},
{
"facet": [
"inf-94ba037a2",
"clamd@scan"
],
"latest.threadCount": 3
},
{
"facet": [
"inf-138df57e6",
"icap"
],
"latest.threadCount": 1
},
{
"facet": [
"inf-94ba037a2",
"icap"
],
"latest.threadCount": 1
}
]
}
}
}
}
}
Here is my config
[[inputs.http]]
## One or more URLs from which to read formatted metrics
urls = ["https://api.newrelic.com/graphql"
]
## HTTP method
method = "POST"
## Optional HTTP headers
headers = **
body = **
## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
data_format = "json"
#Parse `results` array only
json_query = "data.actor.account.nrql.results"
#Exclude host items from tags
tagexclude = ["url","host"]
tag_keys = ["facet"]