Dashboards & Visualizations

Spath command to extract JSON from _raw event

sbd12b
Explorer

This is the basic case:

I have an event

2021-12-28T06:24:17.567|SEARCHING|{"field1":"value1","field2":5,"field3":"la la la"}

My search 

index="redact" SEARCHING | spath path="field3"

Splunk is separating the values, but field3 column is empty for all events.

 

Can anyone please assist? 

Labels (1)
Tags (2)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@sbd12b 

Try this.

index="redact" SEARCHING | rex field=_raw "(?<_raw>\{.*\})" | spath | table field3

My Sample Search :

| makeresults | eval _raw="2021-12-28T06:24:17.567|SEARCHING|{\"field1\":\"value1\",\"field2\":5,\"field3\":\"la la la\"}" | rex field=_raw "(?<_raw>\{.*\})" | spath | table field3


 Thanks
KV
▄︻̷̿┻̿═━一   😉

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

View solution in original post

sbd12b
Explorer

This worked perfect. Thank you for your help!

I had to change the "<" and ">"  to entities and it worked amazing!

| rex field=_raw "(?&lt;_raw&gt;\{.*\})" | 
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@sbd12b 

Try this.

index="redact" SEARCHING | rex field=_raw "(?<_raw>\{.*\})" | spath | table field3

My Sample Search :

| makeresults | eval _raw="2021-12-28T06:24:17.567|SEARCHING|{\"field1\":\"value1\",\"field2\":5,\"field3\":\"la la la\"}" | rex field=_raw "(?<_raw>\{.*\})" | spath | table field3


 Thanks
KV
▄︻̷̿┻̿═━一   😉

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

sbd12b
Explorer

This worked perfect. Thank you for your help!

I had to change the "<" and ">"  to entities and it worked amazing!

| rex field=_raw "(?&lt;_raw&gt;\{.*\})" | 
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...