Splunk Search

help with CASE needed

damucka
Builder

I have the following example:

|makeresults | eval trigger=0|eval decision=case(trigger=1;[|savedsearch test|eval t=1|return $t];0)

producing an error:
Error in 'eval' command: The expression is malformed. Expected )

The intention is clear, I want to execute the savedsearch test under the condition of trigger=1.
Could you please advice what it throws an error?

Kind Regards,
Kamil

Tags (1)
0 Karma

damucka
Builder

sorry, it was an easy mistake. I am closing this question.

0 Karma

niketn
Legend

@damucka if you can please post the fixed query and accept the same as answer to assist others facing similar issue.

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

damucka
Builder

Sure.
I changed it to if, also there should be == instead of =

|makeresults | eval trigger=0|eval decision=if(trigger==1,[|savedsearch test|eval t=1|return $t],0)
0 Karma
Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...