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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...