Splunk Search

Conditional Macros

vganjare
Builder

Hi,

I want to dynamically include macros in search depending on the eval statements. I want to acheive something like

 .... | eval temp = if (condition, macro1, macro2) | further processing.

Is it possible to achieve in Splunk?

Thanks,
Vishal

Tags (2)
0 Karma
1 Solution

MuS
Legend

Hi vganjare,

no, I think it is still not possible, but you can build an eval based macro http://docs.splunk.com/Documentation/Splunk/6.2.1/Search/Usesearchmacros

something like this:

if($arg1$=="condition","true","false")

cheers, MuS

View solution in original post

MuS
Legend

Hi vganjare,

no, I think it is still not possible, but you can build an eval based macro http://docs.splunk.com/Documentation/Splunk/6.2.1/Search/Usesearchmacros

something like this:

if($arg1$=="condition","true","false")

cheers, MuS

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...