<?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: Query for Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595849#M207406</link>
    <description>&lt;P&gt;This probably should be a new question.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2022 19:31:11 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-04-28T19:31:11Z</dc:date>
    <item>
      <title>How can I optimize my search to run faster?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595816#M207399</link>
      <description>&lt;P&gt;Hello Splunkers&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;While running the attached query, results are populating very slow. From that query i want to achieve trend graph by using the line visualisation. But graphs are populating very slow. Please recommend how can I optimize my query to get the results quickly. Please check the attachment for the query.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20220428_212708.jpg" style="width: 4000px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19369iF5541CED27E36CBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IMG_20220428_212708.jpg" alt="IMG_20220428_212708.jpg" /&gt;&lt;/span&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 18:13:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595816#M207399</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2022-04-28T18:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Query for Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595828#M207400</link>
      <description>&lt;P&gt;The query isn't bad.&amp;nbsp; There are a few improvements that can be made, but it's likely that the reason for slow performance is the volume of data being searched.&amp;nbsp; How large is the index and how many indexers do you have?&lt;/P&gt;&lt;P&gt;Some tips to improve performance:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Make the base search (prior to the first |) as specific as possible.&amp;nbsp; Consider adding source and/or sourcetype specifiers.&lt;/LI&gt;&lt;LI&gt;Avoid leading wildcards in search strings.&lt;/LI&gt;&lt;LI&gt;Don't extract fields that aren't used.&amp;nbsp; Remove the second &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; and the &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; commands.&lt;/LI&gt;&lt;LI&gt;Use &lt;FONT face="courier new,courier"&gt;timechart distinct_count()&lt;/FONT&gt; in place of &lt;FONT face="courier new,courier"&gt;dedup | timechart count()&lt;/FONT&gt;.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 28 Apr 2022 17:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595828#M207400</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-04-28T17:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Query for Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595838#M207401</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; Thanks for your response. I will try and let you know the progress.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 18:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595838#M207401</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2022-04-28T18:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Query for Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595839#M207402</link>
      <description>&lt;P&gt;All &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; 's points are valid. Get acquainted with the Job Inspector - it's gonna tell you which part is taking longest and which is processing how many results. It can also show you how much (and where) your search improves as you change it.&lt;/P&gt;&lt;P&gt;I'd say that the most important factor here is the wildcard at the beginning of the search term. Due to the way Splunk works it means that Splunk is unable to just sift through its index files and pick a - hopefully small - subset of events for further filtering and processing but has to examine full text of raw data of each event. Which - especially if you're looking for a rarely encountered term - can make a huuuuge difference.&lt;/P&gt;&lt;P&gt;A quick example from my home installation of splunk free. Let's look into my DNS server events and see how many times I asked it for github during last 7 days (aligned to midnight so we're searching through the same timeframe).&lt;/P&gt;&lt;P&gt;The search is simply&lt;/P&gt;&lt;PRE&gt;index=pihole github earliest=-8d@d latest=@d &lt;BR /&gt;| stats count&lt;/PRE&gt;&lt;P&gt;As a result I get a nice number of 595. If I inspect the job I get the info&lt;/P&gt;&lt;PRE&gt;This search has completed and has returned &lt;SPAN class=""&gt;1&lt;/SPAN&gt; results by scanning &lt;SPAN class=""&gt;595&lt;/SPAN&gt; events in &lt;SPAN class=""&gt;0.934 &lt;/SPAN&gt; seconds &lt;/PRE&gt;&lt;P&gt;If I modify the search to have a wildcard before github&lt;/P&gt;&lt;PRE&gt;index=pihole *github earliest=-8d@d latest=@d &lt;BR /&gt;| stats count&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I get the same result count of 595 (apparently I wasn't visiting any sites named mygithub or porngithub or something like that). But the Job Inspection log shows:&lt;/P&gt;&lt;PRE&gt;This search has completed and has returned &lt;SPAN class=""&gt;1&lt;/SPAN&gt; results by scanning &lt;SPAN class=""&gt;531,669&lt;/SPAN&gt; events in &lt;SPAN class=""&gt;8.086 &lt;/SPAN&gt; seconds&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;As you can see, the search got me the same results but took almost ten times as much time and had to look through thousand times as much data!&lt;/P&gt;&lt;P&gt;And the time difference was relatively small (sic!) only because the whole set of datato search was relatively small and was already cached in RAM. If I was searching through big index on some production cluster, that wildcard could mean a difference between "let's get some coffee before this search completes" and "this search will never end"&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 18:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595839#M207402</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-28T18:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Query for Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595843#M207404</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp; Thanks for sharing all your valuable things on Splunk search performance. This is very huge learning thing for me while creating a SPL query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one other issue related to the search performance. In that I want to optimize my all alert queries. Here I have hardcorded all the services name by giving using the "OR" clause. The services are coming from the raw data without having any field name. How we can optimize this kind of search without using the multiple OR condition.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20220414_173841.jpg" style="width: 4000px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19372iA042B7DAEAF4ED40/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IMG_20220414_173841.jpg" alt="IMG_20220414_173841.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 18:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595843#M207404</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2022-04-28T18:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query for Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595849#M207406</link>
      <description>&lt;P&gt;This probably should be a new question.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 19:31:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-my-search-to-run-faster/m-p/595849#M207406</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-04-28T19:31:11Z</dc:date>
    </item>
  </channel>
</rss>

