Documentation: 3.2
Print Version Contents
This page last updated: 04/22/08 04:04pm

Macro searches

Macro searches are a powerful new feature for saved searches. Save searches with macro fields, which are values you set at search time. You can create a sophisticated saved search with as many macro fields as you like.

Use macro searches in Splunk Web or in Splunk's CLI. Macro searches work similarly to form searches, except there is no graphical user interface component.

Configure a macro search

  • Create a saved search. Use $TERM$ to specify a macro field for substitution. You can specify any number of macro fields.

host=swan OR host=pearl $user$ $trans$Search

  • Save the search and name it. The following example calls the search usertrans.
  • Call your saved search with the savedsearch command. Enter the values to substitute for the macro fields specified in the saved search usertrans. You can specify key value pairs from search or extracted fields, or any other value in your data.

|savedsearch usertrans user=KateAusten trans=querySearch

Note: Use the "I" (pipe) operator before the savedsearch command.

  • The macro search above is equivalent to this search:

host=swan OR host=pearl user=KateAusten trans=querySearch

Previous: Form searches    |    Next: Transaction search

Comments

No comments have been submitted.

Log in to comment.