Splunk Search

Splunk query- How to use spath command for the below logs?

uagraw01
Builder

How to use spath command for the below logs i have attached in the screenshot.

IMG_20220512_184747__01__01.jpg

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

ITWhisperer
SplunkTrust
SplunkTrust

Sorry, I forgot you need to deal with multiline values

| rex "(?ms)Error log: (?<json>\{.*\})"
| spath input=json

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex "Error log: (?<json>\{.*\})"
| spath input=json
0 Karma

uagraw01
Builder

@ITWhisperer Thanks for your reply but it is Not working for me.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What are you getting in the json field?

0 Karma

uagraw01
Builder

@ITWhisperer I have tried this and now it is working fine.

IMG_20220512_195036__01.jpg

0 Karma

uagraw01
Builder

@ITWhisperer  I think rex is not properly working.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Sorry, I forgot you need to deal with multiline values

| rex "(?ms)Error log: (?<json>\{.*\})"
| spath input=json
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...