Splunk Search

edit fields with eval expressions

jerm1020rq
Explorer

I am receiving an error of "The expression is malformed. Expected IN." any time we search utilizing the web data model. When i remove this eval expression 'if(act="File quarantined","blocked",action)' the search works fine so I am assuming that this is the problem child. does anyone see anything inherently wrong with this expression?

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

nickhills
Ultra Champion

Where are you seeing this? Inside the web datamodel?

In which case, the action field should look like this (see attached)

If you really want to include that additional logic into the datamodel (which I am reluctant to advise) you will need to change it to a "case" statement, you cant just layer up additional "if()"s.

 

case(action="File quarantined","blocked", isnull(action) OR action="","unknown", 1=1, action)

 

If my comment helps, please give it a thumbs up!

View solution in original post

Tags (1)

nickhills
Ultra Champion

try changing it to 

 

if(action="File quarantined","blocked",action)

 

That looks to me like the intent is to re-write the action to be "blocked" for a quarantine message, otherwise leave action as it was

if (action = quarantine, re-write it as action="blocked", otherwise set action=action( i.e whatever it already was) )

 

 

If my comment helps, please give it a thumbs up!
0 Karma

jerm1020rq
Explorer

I appreciate the reply, unfortunately it did not work. There are 2 eval expressions seen as below. Does there need to be something in between? Thank you !

if(isnull(action) OR action="","unknown",action)
if(act="File quarantined","blocked",action)

0 Karma

nickhills
Ultra Champion

Where are you seeing this? Inside the web datamodel?

In which case, the action field should look like this (see attached)

If you really want to include that additional logic into the datamodel (which I am reluctant to advise) you will need to change it to a "case" statement, you cant just layer up additional "if()"s.

 

case(action="File quarantined","blocked", isnull(action) OR action="","unknown", 1=1, action)

 

If my comment helps, please give it a thumbs up!
Tags (1)
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...