<?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: Optimizing the search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680614#M232635</link>
    <description>&lt;P&gt;and there is a basic problem with that search anyway, which is that you are using a field called "&lt;STRONG&gt;count&lt;/STRONG&gt;", which does not exist - your timechart will produce a field called &lt;STRONG&gt;dc(symbol)&lt;/STRONG&gt;. I assume that is a typo and that your real search does &lt;STRONG&gt;dc(symbol) as count&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2024 22:55:33 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-03-13T22:55:33Z</dc:date>
    <item>
      <title>Optimizing the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680581#M232619</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I optimize the below query? Can we convert it to tstats?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=abc host=def* stalled
| rex field=_raw "symbol (?&amp;lt;symbol&amp;gt;.*) /"
| eval hourofday = strftime(_time, "%H")
| where NOT (hourofday&amp;gt;2 AND hourofday &amp;lt;= 4)
| timechart dc(symbol) span=15m
| eventstats avg("count") as avg stdev("count") as stdev
| eval lowerBound=-1, upperBound=(avg+stdev*exact(4))
| eval isOutlier=if('count' &amp;lt; lowerBound OR 'count' &amp;gt; upperBound, 1, 0)
| fields _time, "count", lowerBound, upperBound, isOutlier, *
| sort -_time
| head 1
| where isOutlier=1&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Mar 2024 18:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680581#M232619</guid>
      <dc:creator>abhi04</dc:creator>
      <dc:date>2024-03-13T18:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680613#M232634</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use TERM(stalled), as that will help filter the initial data volume retrieved&lt;/P&gt;&lt;P&gt;The order of commands is important - you are doing the rex before the hour constraint - change the order.&lt;/P&gt;&lt;P&gt;You may already have a field called date_hour (it is often extracted by default - check). If so you can put that in the search&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=abc host=def* stalled (date_hour &amp;lt; 3 OR date_hour &amp;gt; 4)
| rex field=_raw "symbol (?&amp;lt;symbol&amp;gt;.*) /"
| timechart dc(symbol) span=15m&lt;/LI-CODE&gt;&lt;P&gt;Replace the NOT with a positive constraint, i.e. check that the hour is &amp;lt; 3 or &amp;gt; 4 rather than NOT &amp;gt;2 AND &amp;lt;4&lt;/P&gt;&lt;P&gt;You can't convert it to tstats unless symbol becomes an indexed field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 22:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680613#M232634</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-03-13T22:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680614#M232635</link>
      <description>&lt;P&gt;and there is a basic problem with that search anyway, which is that you are using a field called "&lt;STRONG&gt;count&lt;/STRONG&gt;", which does not exist - your timechart will produce a field called &lt;STRONG&gt;dc(symbol)&lt;/STRONG&gt;. I assume that is a typo and that your real search does &lt;STRONG&gt;dc(symbol) as count&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 22:55:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680614#M232635</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-03-13T22:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680623#M232641</link>
      <description>&lt;P&gt;This is awesome, thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;. And, yes, it was a type for the "count" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 00:46:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-the-search/m-p/680623#M232641</guid>
      <dc:creator>abhi04</dc:creator>
      <dc:date>2024-03-14T00:46:55Z</dc:date>
    </item>
  </channel>
</rss>

