<?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: Is it possible to bundle multiple searches together? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43087#M10129</link>
    <description>&lt;P&gt;Thank you for your reply! Here is a sample of the queries I'm trying to run: &lt;/P&gt;

&lt;P&gt;&lt;A href="https://gist.github.com/3499469"&gt;https://gist.github.com/3499469&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The log is a basic nginx log. You can see that most of the queries contain 'top', or many 'count's.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2012 16:03:23 GMT</pubDate>
    <dc:creator>balidani</dc:creator>
    <dc:date>2012-08-28T16:03:23Z</dc:date>
    <item>
      <title>Is it possible to bundle multiple searches together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43085#M10127</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I'm trying to run many queries on a log every day. Is it possible to bundle these searches together, so Splunk doesn't have to iterate over the whole log every time?&lt;/P&gt;

&lt;P&gt;I tried searching for an answere here and in the documentation, but I didn't manage to find anything.&lt;BR /&gt;
Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2012 18:33:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43085#M10127</guid>
      <dc:creator>balidani</dc:creator>
      <dc:date>2012-08-23T18:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to bundle multiple searches together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43086#M10128</link>
      <description>&lt;P&gt;Maybe, it depends on the searches. If you give us a sample (2 or 3) of the searches, and a few lines of the log... we might be able to come up with some ideas for you.&lt;/P&gt;

&lt;P&gt;I find that it is often possible to reduce the number of searches, even when you can't bundle &lt;EM&gt;all&lt;/EM&gt; of them together.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2012 20:13:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43086#M10128</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-27T20:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to bundle multiple searches together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43087#M10129</link>
      <description>&lt;P&gt;Thank you for your reply! Here is a sample of the queries I'm trying to run: &lt;/P&gt;

&lt;P&gt;&lt;A href="https://gist.github.com/3499469"&gt;https://gist.github.com/3499469&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The log is a basic nginx log. You can see that most of the queries contain 'top', or many 'count's.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2012 16:03:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43087#M10129</guid>
      <dc:creator>balidani</dc:creator>
      <dc:date>2012-08-28T16:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to bundle multiple searches together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43088#M10130</link>
      <description>&lt;P&gt;Okay, here is how I would do some of these&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="nginx_log" earliest=-1d@d latest=@d
| eval urlGroup = ""
| eval urlGroup = case(match(url,"^/ws/2/label/"),"/ws/2/label/",
                       match(url,"^/ws/2/artist/"),"/ws/2/artist/", 
                       match(url,"^/ws/2/release-group/"),"/ws/2/release-group/", 
                       match(url,"^/ws/2/release/"),"/ws/2/release/",
                       match(url,"^/ws/2/recording/"),"/ws/2/recording/",
                       match(url,"^/ws/2/work/"),"/ws/2/work/")
| top 50 inc by urlGroup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Would do the first 7 searches as a single search. The eighth search can be, in and of itself, dramatically simplified as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="nginx_log"  query="*" earliest=-1d@d latest=@d
| fields url
| eval name = ""
| eval name = case(match(url,"^/ws/1/artist/","Artists",
                   match(url,"^/ws/1/track/"),"Tracks", 
                   match(url,"^/ws/1/release-group/"),"Release-group", 
                   match(url,"^/ws/1/release/"),"Releases",
                   match(url,"^/ws/1/label/"),"Labels")
| stats count by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should be more efficient. The remaining searches could follow this second pattern.&lt;/P&gt;

&lt;P&gt;Try it and see what you think.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2012 21:50:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43088#M10130</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-29T21:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to bundle multiple searches together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43089#M10131</link>
      <description>&lt;P&gt;Thank you! Querying takes a significantly shorter amount of time now.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2012 23:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-bundle-multiple-searches-together/m-p/43089#M10131</guid>
      <dc:creator>balidani</dc:creator>
      <dc:date>2012-09-09T23:17:07Z</dc:date>
    </item>
  </channel>
</rss>

