<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Having a search trigger another search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23444#M4202</link>
    <description>&lt;P&gt;You need to use shell script and curl command to achieve this.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;In the first alert, put the alert condition and run a shell script from that.&lt;/LI&gt;
&lt;LI&gt;In the shell script use the curl command to trigger the 2nd alert.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Thu, 03 Mar 2016 18:39:12 GMT</pubDate>
    <dc:creator>kamal_jagga</dc:creator>
    <dc:date>2016-03-03T18:39:12Z</dc:date>
    <item>
      <title>Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23437#M4195</link>
      <description>&lt;P&gt;Is there a way to trigger another search from a search?  What I have is a syslog search for traffic on a router.  The only way to connect to that router is a windows server.  If the first search yields results, I would like those results emailed.  I have this working.&lt;/P&gt;

&lt;P&gt;I also would like a search that tells me successful logins to the windows server in a given time period.  This works fine.&lt;/P&gt;

&lt;P&gt;However, what I want to do is if the first search finds anything, then trigger the second search.  I have tried ways to do this with subsearches as well as appending the two searches, which works but has too much data (I just want the source IP and a few other fields from the syslog traffic and the username from the server login, not a list of the raw event data).  &lt;/P&gt;

&lt;P&gt;I also tried to set up the second search as an alert with the customer alert condition being the first search, which also did not work.&lt;/P&gt;

&lt;P&gt;The only thing I can think of is to script the second search and have the first search trigger that script.  I am familiar with Python but not very much with Splunk.&lt;/P&gt;

&lt;P&gt;Is there another way to do this and if not, can someone give me any guidance on how to script this?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2010 01:52:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23437#M4195</guid>
      <dc:creator>kholleran</dc:creator>
      <dc:date>2010-07-31T01:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23438#M4196</link>
      <description>&lt;P&gt;(i assume) sourceip and username are actually fields. If so then i think you can use:&lt;/P&gt;

&lt;P&gt;&amp;lt; your search &amp;gt; | fields sourceip, username | dedup sourceip&lt;/P&gt;

&lt;P&gt;Try the above in the search that runs second, this way perhaps you will get less data and only the fields you want?&lt;BR /&gt;
Note, i havent tested this so i cant tell if it works 100% but i think it should...&lt;/P&gt;

&lt;P&gt;Best,&lt;BR /&gt;
.gz&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2010 02:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23438#M4196</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2010-07-31T02:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23439#M4197</link>
      <description>&lt;P&gt;Thank you for the response.  The two searches do not have any related fields.  The first search is syslog data which has items like host, src_ip, and some custom fields to provide information about the location.  The second is hitting the windows event log, which I only care about the Account_Name field .&lt;/P&gt;

&lt;P&gt;I guess I do not fully understand your suggestion.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23439#M4197</guid>
      <dc:creator>kholleran</dc:creator>
      <dc:date>2020-09-28T09:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23440#M4198</link>
      <description>&lt;P&gt;well from what i understood it seemed like the first search is running, and returning some sort of result. If the result &amp;gt; 0 (or whatever condition you have put) it seems like a second search is running and returning results, but theres too much noise and not easy for you to see the necessary info. (you say - "I have tried ways to do this with subsearches as well as appending the two searches, which works but has too much data") &lt;BR /&gt;
So, if that is the case, what you see is results to your second search but too much noise,&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2010 03:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23440#M4198</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2010-07-31T03:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23441#M4199</link>
      <description>&lt;P&gt;So you can ask your search to only show you the field you are interested in, and dedup by that field (so you do not get duplicates)...&lt;BR /&gt;
Perhaps im not understanding your question too well either &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2010 03:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23441#M4199</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2010-07-31T03:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23442#M4200</link>
      <description>&lt;P&gt;(sorry, couldnt fit all the reply into one comment)&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2010 03:58:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23442#M4200</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2010-07-31T03:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23443#M4201</link>
      <description>&lt;P&gt;I've been working on a solution to do this (link below).  As of yet, it not working 100% and there are some gotchas.   (One of the bugs preventing me from doing this was schedule to be fixed in 4.1.4, but I haven't gotten around to verifying that it resolved the issue for me.)  The other issue has to do with missing UI support, but I suspect that could be some work around for this too (but for now it means editing &lt;CODE&gt;savedsearches.conf&lt;/CODE&gt; by hand.)&lt;/P&gt;

&lt;P&gt;I'll try to update this (and possibly publish it in the form of an "app") once I get something that's worth sharing.  But the basic premise of my solution is to simply add a new alert action that simply launches another saved search.  (The approach is very simple at the moment, but I have some other features I'd like to play around with.  For example, passing a 'pid' (or some other field) form the first search to the second search using a search template.)&lt;/P&gt;

&lt;P&gt;Related question:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://answers.splunk.com/questions/3099/can-one-scheduled-saved-search-trigger-another-saved-search" rel="nofollow"&gt;Can one scheduled saved search trigger another saved search?&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;If you would like to work together on a solution.  Please let me know.  I can send you what I've come up with so far as a starting point.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;  I have confirmed that 4.1.4 resolved the technical issue that was preventing my solution from working.  So I should be able to release a working app for this in the near future; assuming I get enough spare time to complete this.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;I have posted an my app on SplunkBase, which you can download here:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.splunkbase.com/apps/All/4.x/app%3aRunSavedSearch+alert+action" rel="nofollow"&gt;RunSavedSearch alert action&lt;/A&gt;    &lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;EM&gt;Note:  This app was uploaded Aug 5th and is currently pending approval.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2010 23:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23443#M4201</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-08-02T23:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23444#M4202</link>
      <description>&lt;P&gt;You need to use shell script and curl command to achieve this.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;In the first alert, put the alert condition and run a shell script from that.&lt;/LI&gt;
&lt;LI&gt;In the shell script use the curl command to trigger the 2nd alert.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 03 Mar 2016 18:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/23444#M4202</guid>
      <dc:creator>kamal_jagga</dc:creator>
      <dc:date>2016-03-03T18:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/564967#M196807</link>
      <description>&lt;P&gt;Does this app still exist?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 06:17:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/564967#M196807</guid>
      <dc:creator>jnhth</dc:creator>
      <dc:date>2021-08-27T06:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Having a search trigger another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/564974#M196810</link>
      <description>If you need the functionality that do a search only if first search return something then you should look require command on splunk 8.2. This is probably what you are needing?&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/Require" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/Require&lt;/A&gt;&lt;BR /&gt;r. Ismo</description>
      <pubDate>Fri, 27 Aug 2021 07:00:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Having-a-search-trigger-another-search/m-p/564974#M196810</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-08-27T07:00:45Z</dc:date>
    </item>
  </channel>
</rss>

