Set up a search workflow action
To set up workflow actions that launch dynamically populated secondary searches, you start by setting Action type to search on the Workflow actions detail page. This reveals a set of Search configuration fields that you use to define the specifics of the secondary search.
In Search string enter a search string that includes one or more placeholders for field values, bounded by dollar signs. For example, if you're setting up a workflow action that searches on client IP values that turn up in events, you might simply enter
clientip=$clientip$ in that field.
Identify the app that the search runs in. If you want it to run in a view other than the current one, select that view. And as with all workflow actions, you can determine whether it opens in the current window or a new one.
Be sure to set a time range for the search (or identify whether it should use the same time range as the search that created the field listing) by entering relative time modifiers in the in the Earliest time and Latest time fields. If these fields are left blank the search runs over all time by default.
Finally, as with other workflow action types, you can restrict the search workflow action to events containing specific sets of fields and/or which belong to particular event types.
Example - Launch a secondary search that finds errors originating from a specific Ruby On Rails controller
In this example, we will be using a web infrastructure that is built on Ruby on Rails. You've set up an event type to sort out errors related to Ruby controllers (titled
controller_error), but sometimes you just want to see all the errors related to a particular controller. Here's how you might set up a workflow action that does this.
- On the Workflow actions detail page, set up an action with the following Label:
See other errors for controller $controller$ over past 24h.
- Set Action type to Search.
- Enter the following Search string:
sourcetype=rails controller=$controller$ error=*
- Set an Earliest time of -24h. Leave Latest time blank.
- Using the Apply only to the following... settings, arrange for the workflow action to only appear in events that belong to the
controller_errorevent type, and which contain the
Those are the basics. You can also determine which app or view the workflow action should run in (for example, you might have a dedicated view for this information titled
ruby_errors) and identify whether the action works in the current window or opens a new one.
Set up a POST workflow action
Control workflow action appearance in field and event menus
This documentation applies to the following versions of Splunk® Enterprise: 7.0.0, 7.0.1, 7.0.2, 7.0.3, 7.0.4, 7.0.5, 7.0.6, 7.0.7, 7.0.8, 7.0.9, 7.0.10, 7.0.11, 7.1.0, 7.1.1, 7.1.2, 7.1.3, 7.1.4, 7.1.5, 7.1.6, 7.1.7, 7.1.8, 7.1.9, 7.2.0, 7.2.1, 7.2.2, 7.2.3, 7.2.4, 7.2.5, 7.2.6, 7.2.7, 7.2.8, 7.3.0, 7.3.1, 7.3.2