Getting Data In

How to use spath command in props.conf or transforms.conf in Splunk?

MAMAOUI
Explorer

Hello ,

I used spath command to extract field from json data:

{"key":"value", "key":"value", "key":"value", "key":"value", "key":"value" ...}

and I got the results that I wanted (.. | spath input = json)

My question is how can I get the same results in props.conf or transforms.conf?

Thank you for answer

M&A

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use INDEXED_EXTRACTIONS = JSON in props.conf.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Use INDEXED_EXTRACTIONS = JSON in props.conf.

---
If this reply helps you, Karma would be appreciated.

MAMAOUI
Explorer

I used KV_MODE=JSON and it works but my probleme is that i have 2 json
format in the same data :

{"key1":"value1", "key2":"value2", "key3": "{\"key30\":values30,\"key31\":values31........ \"}"}

I dont know if there are any way to use spath in props , some thig like
Eval-Key3=spath ....

Thankyou

0 Karma

MuS
Legend

Nope, that will not work. But you can use any kind of regex as transforms to get around this JSON in JSON problem. See this answer https://answers.splunk.com/answers/319646/how-to-write-the-regex-to-extract-data-inside-squa.html to learn how it can be done.

Additional hint: the regex mentioned in this answer will not work for your JSON in JSON thing ... try \\"([^\\]+)\\":([^,]+) for a start 😉

cheers, MuS

0 Karma

MAMAOUI
Explorer

ok I will try .thank you

0 Karma
Get Updates on the Splunk Community!

Financial Services Industry Use Cases, ITSI Best Practices, and More New Articles ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Splunk Federated Analytics for Amazon Security Lake

Thursday, November 21, 2024  |  11AM PT / 2PM ET Register Now Join our session to see the technical ...

Splunk With AppDynamics - Meet the New IT (And Engineering) Couple

Wednesday, November 20, 2024  |  10AM PT / 1PM ET Register Now Join us in this session to learn all about ...