Looking to create macros with parameters in splunk? We have come with another interesting topic in Splunk, Today we are going to discuss about how to create macros with parameters in splunk.

What are macros?
A knowledge object that will be reused. It contains a portion of a search or a search function. A search macro has a unique name. When you reference a search macro in a search, you use back tick character to denote the start and end of the macro reference
For example, to run a search with a search macro titled pageviews_per_second, type : `pageviews_per_second`.
How to Create Macros –
  • Create your search query which you want to make macro
before creating macros with parameters in splunk
 
  • Click on setting.
  • Open Advance Search.
  • Select  option ‘Search macro’.
  • Click on “Add new” to create a new macros.
creating macros with parameters in splunk
 

Searching the Macros and passing Argument

Enter your macro name in search and pass the agruments. Here i am passing the argument USD,$ and 73.

after creating macros with parameters in splunk
 

Hope this has helped you in achieving the requirement.

If you are still facing issue regarding macros with parameters in splunk Feel free to Ask Doubts in the Comment Box Below and Don’t Forget to Follow us on 👍 Social Networks, happy Splunking >😉