Splunk Search

Else if like not working with json type data

Jarohnimo
Builder

Hello All

I'm trying to use eval if like command with json type data (kv_mode = json) but it seems as though it's not respecting the command when used on this type of data.

I'm searching Nessus data and we are using Splunk_TA_nessus


I'm trying to do something like:

index=nessusdata sourcetype="tenable:sc:vuln" scan_result_info.name="my scan*"
| eval newfield=if(like(scan_result_info.name, "my scan%"), "it's working", "it's not working")

All results return as not working meaning the if like eval isn't working.

I've tried it eval a=if(scan_result_info.name like "my scan%", "working", "not working")

Neither works with Nessus type data but everything works when I use the same commands on iis type data. I know that I'm typing the commands correctly.

Could someone explain to me how to get this to work with data where kv_mode = json

Is there another way to go about this or am I out of luck with eval if like against Json type data?

Labels (1)
0 Karma

Jarohnimo
Builder

I think I found a solution. I have to rename the json field to something simpler them it'll allow me to use the function properly.

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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