Splunk Search

How does splunk split field contents in dictionary format?

Cathy
Engager

current splunk log:

user=a,ip=b,info={'gender':1,'Country':2},p=1,

target splunk table:

 user=a,ip=b,gender=1,Country=2,p=1,

 

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Your log looks pretty standard and fields can be parsed into name/value pairs with the extract command. Then, your info field looks a bit like JSON only you have single quotes instead of double quotes. Your can switch these with the replace function, Then you can parse the (now correct) JSON field with the spath command

| extract
| eval info=replace(info,"'","\"")
| spath input=info

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Your log looks pretty standard and fields can be parsed into name/value pairs with the extract command. Then, your info field looks a bit like JSON only you have single quotes instead of double quotes. Your can switch these with the replace function, Then you can parse the (now correct) JSON field with the spath command

| extract
| eval info=replace(info,"'","\"")
| spath input=info

Cathy
Engager
Thank you for your answer. It works!
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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