Getting Data In

How to access a JSON that does not have a field name?

wantjoule
Engager

Hi All,

I've used spath before to access JSON, but the log entry i currently have does not have a name associated to the JSON and i am having a hard time cracking into it. in the example log entry below i might want to extract out the src_ip,a_labels>app, a_labels>env

raw:

sev=INFO pid=5675 tid=7777567567 rid=0 {"tbo":40,"pn":"name.exe","src_ip":"11.22.33.44""a_labels":[{"app":"appname1"},{"env":"env1"}],"b_labels":[{"app":"appname2"}{"env":"env2"}],"pd":0}


sev=INFO  
pid=5675 
tid=7777567567 
rid=0 
    {
        "tbo":40,
        "pn":"name.exe",
        "src_ip":"11.22.33.44"
        "a_labels":
            [
                {"app":"appname1"},
                {"env":"env1"}
            ],
        "b_labels":
            [
                {"app":"appname2"}
                {"env":"env2"}
            ],
        "pd":0
    }

somesoni2
Revered Legend

You would need to extract that json string into a field and then use spath command. Like this

your base search | rex "^(\S+\s+){4}(?<json_data>\{.+)" | spath input=json_data
0 Karma

wantjoule
Engager

Thank you @somesoni2 but i tried this and it didn't seem to extract the JSON into the field, so the spath didn't work

Can you explain what is happening in the rex.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...