All Apps and Add-ons

How to un-nest TagList on aws addon?

clamarkv
Explorer
im trying to play around with tags from our aws environments (using the aws addon metadata input)

the tags come in looking like this:
 
"TagList": [
{"Key": "Project", "Value": "project1"}
{"Key": "ProdState", "Value": "prod"}
{"Key": "Product", "Value": "product1"}
{"Key": "Team", "Value": "team1"}
{"Key": "power_state", "Value": "-1:1800:1900:-1:1800:1900:-1:1800:1900:-1:1800:1900:-1:1800:1900:-1:-1:-1:-1:-1:-1:Australia/Brisbane"}
{"Key": "CostCentre", "Value": "000000"}
{"Key": "workload_type", "Value": "production"}
{"Key": "Name", "Value": "name1"}
]​


to make life easier for myself, i am trying to un-nest these tags - ultimately i want this to look something like this:

tags.Project = project1
tags.ProdState = prod
tags.Product = product1
...

ive tried with a foreach like this (below), but it doesnt seem to get all my tags out - for example, it will only extract CostCenter, ProdState Project and workload_type.
 
 
index=testing source="xxxxxxxxxxxx:ap-southeast-2:rds_instances"
| spath TagList{} output=tmp_taglist
| foreach tmp_taglist{}
[ rex "..Key.:\s\"(?<this_key>[^\"]+)\".\s.Value..\s\"(?<this_value>[^\"]+)\"."
| eval tags.{this_key} = this_value ]
| table DBInstanceArn tmp_taglist tags.*​
 
 

can anyone help me understand what i am doing wrong here ?
Labels (1)
0 Karma
Get Updates on the Splunk Community!

Detecting Brute Force Account Takeover Fraud with Splunk

This article is the second in a three-part series exploring advanced fraud detection techniques using Splunk. ...

Buttercup Games: Further Dashboarding Techniques (Part 9)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Buttercup Games: Further Dashboarding Techniques (Part 8)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...