<?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: Speed Search Review in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471670#M132709</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* ((sourcetype = x_connections src=*) OR (sourcetype= x_collectors name=*)) engine="engine" Src_SubnetName = "vpn" 
| eval src= coalesce(src,name) 
| eval Dates = strftime(_time, "%F") 
| stats estdc(src) as distinct_src_count by Src_Sitename, Dates
| rename Src_Sitename as Src_SubnetName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your query has extra calculations.&lt;BR /&gt;
How about this?&lt;/P&gt;</description>
    <pubDate>Tue, 14 Apr 2020 00:45:15 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-04-14T00:45:15Z</dc:date>
    <item>
      <title>Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471661#M132700</link>
      <description>&lt;P&gt;Hello Everyone.&lt;/P&gt;

&lt;P&gt;I m new to splunk and I have one search which is taking a bit longer than others. Is there any suggestion on how to improve this search ?&lt;/P&gt;

&lt;P&gt;index=mydatasource_*  (sourcetype = x_connections OR sourcetype= x_collectors) engine="&lt;EM&gt;engine&lt;/EM&gt;" Src_SubnetName = "&lt;EM&gt;vpn&lt;/EM&gt;"| eval src= if(isnull(src),name, src)&lt;BR /&gt;
| eval Dates = _time&lt;BR /&gt;
| eval Src_SubnetName = Src_Sitename&lt;BR /&gt;
| convert timeformat="%Y-%m-%d" ctime(Dates)&lt;BR /&gt;
| stats dc(src) by src,Src_SubnetName, Dates&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/286791-2020-04-13-14h46-08.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:56:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471661#M132700</guid>
      <dc:creator>rafazurc</dc:creator>
      <dc:date>2020-09-30T04:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471662#M132701</link>
      <description>&lt;P&gt;How long is "a bit"?  How much data is being searched?  Searching more data will take more time.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 15:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471662#M132701</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-13T15:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471663#M132702</link>
      <description>&lt;P&gt;Hello @richgalloway . &lt;/P&gt;

&lt;P&gt;To search the last 24hours (~200M events ) takes around 45 minutes. and generates ~80k Results.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 15:12:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471663#M132702</guid>
      <dc:creator>rafazurc</dc:creator>
      <dc:date>2020-04-13T15:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471664#M132703</link>
      <description>&lt;P&gt;@rafazurc  The more specific you can make a search before the first &lt;CODE&gt;|&lt;/CODE&gt;, the faster it will be. Do you need need blank src in your results? The put in src=*, to get rid of blanks. Do you need all those indexes? Is there any other detail, even a word or two that will appear in every result? Put all of that up front before the first pipe. Otherwise, it is what it is. The rest of your SPL isn't expensive.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 17:21:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471664#M132703</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-04-13T17:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471665#M132704</link>
      <description>&lt;P&gt;The &lt;CODE&gt;dc&lt;/CODE&gt; aggregation function can be very expensive. Did you job inspector give any insight as to where the time is being spent? I'm also curious what you're ultimately trying to achieve...knowing that may help the community  solve your challenge.&lt;/P&gt;

&lt;P&gt;See &lt;A href="https://answers.splunk.com/answers/615744/why-is-there-forceful-termination-of-the-search-pr.html"&gt;this link&lt;/A&gt; for info on &lt;CODE&gt;dc&lt;/CODE&gt; and how to work around it.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 17:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471665#M132704</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-04-13T17:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471666#M132705</link>
      <description>&lt;P&gt;Hello @efavreau. As I have 2 sourcetype and one has src and other name. Does it work to add before the first pipe (src=* OR name=*) Thanks &lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 17:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471666#M132705</guid>
      <dc:creator>rafazurc</dc:creator>
      <dc:date>2020-04-13T17:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471667#M132706</link>
      <description>&lt;P&gt;Hello @jpolvino. I ve added the print of mu job inspector results. What I m trying to achieve is. I have 2 sourcetypes one is the connection and the other collector. The fist one, the field I need to use is src, the second is name. So I m trying to check each event and if src is null consider the name.&lt;/P&gt;

&lt;P&gt;After that, I m formatting _time as date, and the SubnetName is a common field for both sourcetypes. The result I need is to list distinct src by each network by day.&lt;/P&gt;

&lt;P&gt;I really would like to optimize this search to reduce the search cost. I m checking the link you ve sent looking for more hints.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 18:00:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471667#M132706</guid>
      <dc:creator>rafazurc</dc:creator>
      <dc:date>2020-04-13T18:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471668#M132707</link>
      <description>&lt;P&gt;@rafazurc If you need these fields, then adding &lt;CODE&gt;(src=* OR name=*)&lt;/CODE&gt; is better than not having it.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 18:03:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471668#M132707</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-04-13T18:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471669#M132708</link>
      <description>&lt;P&gt;Hello @rafazurc ,&lt;/P&gt;

&lt;P&gt;run these searches (use the "smart mode", use a short period like last 60min instead of last 24hours) and post their search.log (your search.log screenshot is &lt;STRONG&gt;not&lt;/STRONG&gt; complete and some important information can be missed) :&lt;/P&gt;

&lt;P&gt;search 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* (sourcetype = x_connections OR sourcetype= x_collectors) engine="engine" Src_SubnetName = "vpn"| eval src= if(isnull(src),name, src)
| eval Dates = _time
| eval Src_SubnetName = Src_Sitename
| convert timeformat="%Y-%m-%d" ctime(Dates)
| stats dc(src) by src,Src_SubnetName, Dates
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search 2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* (sourcetype = x_connections OR sourcetype= x_collectors) engine="engine" Src_SubnetName = "vpn"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search 3:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* (sourcetype = x_connections OR sourcetype= x_collectors) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;by comparing durations of command.search component you'll get the idea if your search can be [easily] optimized.&lt;/P&gt;

&lt;P&gt;search 4:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* sourcetype = x_connections
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search 5:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* sourcetype= x_collectors
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;also check the splunk documentation and try to find out if this a rare/sparse or rare search&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 23:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471669#M132708</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-04-13T23:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471670#M132709</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=mydatasource_* ((sourcetype = x_connections src=*) OR (sourcetype= x_collectors name=*)) engine="engine" Src_SubnetName = "vpn" 
| eval src= coalesce(src,name) 
| eval Dates = strftime(_time, "%F") 
| stats estdc(src) as distinct_src_count by Src_Sitename, Dates
| rename Src_Sitename as Src_SubnetName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your query has extra calculations.&lt;BR /&gt;
How about this?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 00:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471670#M132709</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-14T00:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Speed Search Review</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471671#M132710</link>
      <description>&lt;P&gt;To add to what @efavreau said about identifying words that will end up in every result... &lt;/P&gt;

&lt;P&gt;I've had a lot of success using the [Patterns] analysis of search results to identify these words.  &lt;/P&gt;

&lt;P&gt;Also, [All Fields] and then sorting to see fields with maximum "100% Event Coverage" and "# of Values" can help as well.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 01:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Speed-Search-Review/m-p/471671#M132710</guid>
      <dc:creator>sectrainingjk</dc:creator>
      <dc:date>2020-04-14T01:39:16Z</dc:date>
    </item>
  </channel>
</rss>

