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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...