Getting Data In

How to extract json from event with = separated values?

zachsisinst
Explorer

 

Hello, I have the following type of event, and I would like to extract the `tags` field into its respective fields. 

 

2022-10-17 06:50:00.997, root_device_name="/dev/sda1", root_device_type="ebs",  state_name="running", subnet_id="subnet-REDACTED", tags="{"App": "myapp", "Name": "myserver", "Owner": "myteam", "Scope": "myscope", "AWSBackup": "True", "Environment": "myenv", "Compliance requirement": "N/A"}", virtualization_type="hvm",  vpc_id="vpc-REDACTED"

 



I have tried the following which did not work for me: 

 

index=myindex sourcetype=mysourcetype earliest=@d i-REDACTED source=awsec2instances
| spath input=tags 

 

How do I extract these JSON fields from an event like this? 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| rex "tags=\"(?<tags>\{[^\}]+\})"
| spath input=tags
0 Karma
Get Updates on the Splunk Community!

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...