Splunk Search

How to pass eval value as macro parameter where my search query starts with macro itself

New Member

We have created reusable macro which was used in many reports with 3 parameters and that macro is starting point of query. one parameter takes Month (i.e 02/01/2017 ...) from filter. Now i got requirement where i need to provide current month/previous month to macro as parameter . Since query begins with macro i unable to create eval expression .


|eval month = strftime(now(),"%m/01/%Y") | 'ADForecast("$Domain$,month)'

since ,we cannot start a query with eval i unable to pass current month. please suggest how to pass current month.

0 Karma

Splunk Employee
Splunk Employee

You can either start the search with :
search | ...
or use

| makeresults | ...

0 Karma

Revered Legend

Try like this. Assuming you're going to put this query in a dashboard (based on $Domain$ token used), put below query in the panel

|gentimes start=-1 | eval month=strftime(now(),"%m/01/%Y") | map search=" 'ADForecast("$Domain$,$$month$$)'
0 Karma