Splunk Search

Can one search trigger another?

a212830
Champion

Hi,

Is there a way for one search, once it's complete, to trigger another search?

1 Solution

woodcock
Esteemed Legend

You can use depends in dashboards so that when one panel completes, the dependent panel will start. The closest that you can do for an ad-hoc search is to pull a saved search into another search like this:

You First Search | appendpipe [ | savedsearch Your:Second:Search ]

You can run splunk searches from the CLI so you could setup a cron like this:

00 12 * * * * /opt/splunk/bin/splunk Your First Search Details Here && /opt/splunk/bin/splunk Your Second Search Details Here

You could also make the first search an alert with an always trigger action to call a custom script that does the second part (like the CLI/cron).

I have asked for this feature for saved searches but do not expect any action.

View solution in original post

sloshburch
Splunk Employee
Splunk Employee

I'm still a fan of the post processing. If the panels are all similar base searches then a post processing is the strongest approach because it has the least dependencies and only moderate complexity.

Alternatively, an accelerated data model could help them render any such searches with speed.

0 Karma

arkadyz1
Builder

This is too wide and too vague of a question. One potential solution: if you are ready to work with JavaScript, you should be able to achieve this, watching for search:done event of a search.

0 Karma

somesoni2
Revered Legend

Could you add more details on what each of the search does and what creates the dependency on the order?

0 Karma

a212830
Champion

I have a customer who has a dashboard with lots of panels - 10/12. I'd rather not have that many searches kick off at once, and according to the customer, these panels aren't used enough to justify him scheduling the search (plus, he''d prefer it to be current). I thought a good alternative would be to have some of these searches kick off other searches, if possible. I've also explained the concept of post-processing to the customer, and he is looking into that possibility.

0 Karma

woodcock
Esteemed Legend

Look at using a base search in your dashboard and if that won't work, you can stage the searches in the panels with depends as I described in my answer.

0 Karma

woodcock
Esteemed Legend

You can use depends in dashboards so that when one panel completes, the dependent panel will start. The closest that you can do for an ad-hoc search is to pull a saved search into another search like this:

You First Search | appendpipe [ | savedsearch Your:Second:Search ]

You can run splunk searches from the CLI so you could setup a cron like this:

00 12 * * * * /opt/splunk/bin/splunk Your First Search Details Here && /opt/splunk/bin/splunk Your Second Search Details Here

You could also make the first search an alert with an always trigger action to call a custom script that does the second part (like the CLI/cron).

I have asked for this feature for saved searches but do not expect any action.

skoelpin
SplunkTrust
SplunkTrust

I would agree that using options in your dashboard is the best approach to have a second search triggered by the first

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi a212830,
I don't think that it's possible, You could create and schedule an alert (first search) that as action runs a script that contain the second search, but I don't know if this is what you need!
Bye.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...