Getting Data In

Spath for getting date json field

splkdylb
New Member

Hi all,

I'm trying to use spath to extract JSON data from a field name that represents a date:

{
"field1": {
"2019-01-02": []
}
}

but when I try spath input=message output=result field1.2019-01-02 it's not working. I tried to replace the field name with another text (i.e. replace "2019-02-01" with "targetDate") and setting the replaced result in the spath input parameter but it is still not working.

Thank you for your help.

0 Karma

anantcd
Explorer

Try this SPL:

| makeresults 
| eval message="{\"foo\":{\"2019-01-02\":[{\"zoo\":1},{\"baz\":2}]}}" 
| spath input=message output=result path=foo.2019-01-02{}
0 Karma

woodcock
Esteemed Legend

Show us an entire raw event.

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...