<?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: Run saved search multiple times in same query? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328882#M4766</link>
    <description>&lt;P&gt;You might be able to use &lt;CODE&gt;selfjoin&lt;/CODE&gt; (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Selfjoin"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Selfjoin&lt;/A&gt;) but better yet, try &lt;CODE&gt;multireport&lt;/CODE&gt; (no docs on this yet), like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro"
| multireport
    [| stats count BY host]
    [| stats count BY sourcetype]
    [| stats count BY server]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or &lt;CODE&gt;multisearch&lt;/CODE&gt;, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
    [| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | eval set=1] 
    [| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | eval set=2] 
    [| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | eval set=3]
| stats count BY set
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Jun 2017 03:47:33 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-06-07T03:47:33Z</dc:date>
    <item>
      <title>Run saved search multiple times in same query?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328881#M4765</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;We used to append saved search results as following without problem:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | append [|savedsearch Test_VPN_log_stats  ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when same saved search is used, e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| savedsearch Test_VPN_log_stats| append [|savedsearch Test_VPN_log_stats  ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We'll get error like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'SearchParser': Found circular dependency when expanding savedsearch=Test_VPN_log_stats
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Would like to know if it's possible to:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;append output of same saved query multiple times? &lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;pass fields from the first saved search to the appending ones, e.g.  IPAddr and UserName are 2 of the resulting field from saved search Test_RADIUS_report:&lt;/P&gt;

&lt;P&gt;| savedsearch Test_RADIUS_report ipaddr="&lt;EM&gt;" username="Amuro" | append [|savedsearch Test_RADIUS_report ipaddr=$IPAddr username="&lt;/EM&gt;" ] |append [| savedsearch Test_RADIUS_report ipaddr="*" username=$UserName ]  | more append ....&lt;BR /&gt;
Sorry that I've old school thinking and and hope savedsearch can be used as function call that can be called recursively.&lt;BR /&gt;
Would anyone please help?&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks a lot.&lt;BR /&gt;
Regards&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:19:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328881#M4765</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2020-09-29T14:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Run saved search multiple times in same query?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328882#M4766</link>
      <description>&lt;P&gt;You might be able to use &lt;CODE&gt;selfjoin&lt;/CODE&gt; (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Selfjoin"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Selfjoin&lt;/A&gt;) but better yet, try &lt;CODE&gt;multireport&lt;/CODE&gt; (no docs on this yet), like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro"
| multireport
    [| stats count BY host]
    [| stats count BY sourcetype]
    [| stats count BY server]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or &lt;CODE&gt;multisearch&lt;/CODE&gt;, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
    [| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | eval set=1] 
    [| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | eval set=2] 
    [| savedsearch Test_RADIUS_SavedSearch ipaddr="*" bool="" username="Amuro" | eval set=3]
| stats count BY set
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jun 2017 03:47:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328882#M4766</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-07T03:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Run saved search multiple times in same query?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328883#M4767</link>
      <description>&lt;P&gt;That's helpful.  Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 08:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Run-saved-search-multiple-times-in-same-query/m-p/328883#M4767</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2017-06-07T08:34:50Z</dc:date>
    </item>
  </channel>
</rss>

