Splunk Search

Can't use eval function on fields extracted from json log using spath

myobmatt
New Member

I have extracted fields from a json log using spath, I want to add double quotes to the tabled results using ... | eval myval="\"".myval."\"" but no eval function seems to work on the fields extracted in this way. What am I doing wrong??

Tags (1)
0 Karma

niketn
Legend

@myobmatt can you add some JSON data sample along with the field name that spath extracts?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

myobmatt
New Member

Any field that I have extracted from the json log using spath, when I try to apply ANY eval function, comes up blank when I try to table it

0 Karma

tiagofbmm
Influencer

Hi

You jus need one set of \" in the beginning and one in the end, like this

| eval myval="\""+myval+"\""
0 Karma

tiagofbmm
Influencer

Please let me know if the answer was useful for you. If it was, accept it and upvote. If not, give us more input so we can help you with that

0 Karma

493669
Super Champion

Hi
have you tried this:

|eval myval="\"".myval."\""
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 at Splunk .conf24 ...

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 ...