<?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 Search performance and optimization in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105875#M27507</link>
    <description>&lt;P&gt;when I search with below query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=my_log UUID="3fc5e6c2-57b4-4e59-a3c0-8115f5ec74a1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search result will appear within one second amazing fast &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
this log information is older then one month&lt;/P&gt;

&lt;P&gt;but when I search with this query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=my_log | transaction startswith=log_begin endswith=log_end | where UUID="3fc5e6c2-57b4-4e59-a3c0-8115f5ec74a1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It'll take 8 to 10 minutes to display the result &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; extremely slow&lt;/P&gt;

&lt;P&gt;Now I have two question&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;How to improve this search with transaction?&lt;/LI&gt;
&lt;LI&gt;How do I stop my search after first result because after getting this result Splunk keep continue to search and I know there is no more results?&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Thu, 31 Jan 2013 10:45:01 GMT</pubDate>
    <dc:creator>jangid</dc:creator>
    <dc:date>2013-01-31T10:45:01Z</dc:date>
    <item>
      <title>Search performance and optimization</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105875#M27507</link>
      <description>&lt;P&gt;when I search with below query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=my_log UUID="3fc5e6c2-57b4-4e59-a3c0-8115f5ec74a1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search result will appear within one second amazing fast &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
this log information is older then one month&lt;/P&gt;

&lt;P&gt;but when I search with this query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=my_log | transaction startswith=log_begin endswith=log_end | where UUID="3fc5e6c2-57b4-4e59-a3c0-8115f5ec74a1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It'll take 8 to 10 minutes to display the result &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; extremely slow&lt;/P&gt;

&lt;P&gt;Now I have two question&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;How to improve this search with transaction?&lt;/LI&gt;
&lt;LI&gt;How do I stop my search after first result because after getting this result Splunk keep continue to search and I know there is no more results?&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 31 Jan 2013 10:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105875#M27507</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2013-01-31T10:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Search performance and optimization</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105876#M27508</link>
      <description>&lt;P&gt;The first query is fast because splunk can use index data to narrow down the events that need to be loaded.&lt;BR /&gt;
The second query is slow because splunk has to push everything into the transaction command, which then is slow because it can't handle large (in splunk terms) amounts of data.&lt;/P&gt;

&lt;P&gt;One way to speed things up is to narrow down the time range that needs to be searched.&lt;BR /&gt;
Other ways depend on your data and what you do with it.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 11:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105876#M27508</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-01-31T11:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Search performance and optimization</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105877#M27509</link>
      <description>&lt;P&gt;Does the &lt;CODE&gt;UUID&lt;/CODE&gt; field exist in all events you are interested in?  Like martin_mueller said the first search is fast because index data is used to narrow down your search results.  But the second search is very slow because it is handling so much data.  If i understand the search pipeline correctly, your second search is taking the entire contents of &lt;CODE&gt;my_log&lt;/CODE&gt; and trying to apply the &lt;CODE&gt;transaction&lt;/CODE&gt; function to it before narrowing it down again with the &lt;CODE&gt;where&lt;/CODE&gt; command.  &lt;CODE&gt;Transaction&lt;/CODE&gt; is an intensive operation and you'll want to narrow down your search results as much as possible before piping to it.  Additionally, if there is a field that uniquely identifies log entries as part of a transaction, you should include them as the optional field list of the &lt;CODE&gt;transaction&lt;/CODE&gt; command, this makes it easier for &lt;CODE&gt;transaction&lt;/CODE&gt; to group events together.  Would a search like one of the following accomplish what you need?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=my_log UUID="3fc5e6c2-57b4-4e59-a3c0-8115f5ec74a1" | transaction UUID startswith=log_begin endswith=log_end&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:12:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105877#M27509</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2020-09-28T13:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search performance and optimization</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105878#M27510</link>
      <description>&lt;P&gt;NO UUID appears only once in a transaction, I understand the reason but 8 minutes is not good for search the log. Is there any other alternate e.g. to display x line before UUID field and y line after UUID field.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 14:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105878#M27510</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2013-01-31T14:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Search performance and optimization</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105879#M27511</link>
      <description>&lt;P&gt;8 minutes is understandable since you're telling Splunk to retrieve all events from disk before really doing anything.&lt;/P&gt;

&lt;P&gt;You might want to look into the localize command: &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.1/SearchReference/Localize"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.1/SearchReference/Localize&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 14:47:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105879#M27511</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-01-31T14:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Search performance and optimization</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105880#M27512</link>
      <description>&lt;P&gt;So I realize I'm way late to the party here, but what about using a subsearch? Assuming that there is a field in your log data (let's call it myTransactionID) can be used to uniquely identify a transaction, you could do something like:&lt;/P&gt;

&lt;P&gt;sourcetype=my_log [search sourcetype=my_log UUID="3fc5e6c2-57b4-4e59-a3c0-8115f5ec74a1" | dedup myTransactionID | fields myTransactionID] | transaction startswith=log_begin endswith=log_end&lt;/P&gt;

&lt;P&gt;Essentially, what the subsearch does is find the initial log with the specified UUID value, obtain the value of myTransactionID, and then pass that as an argument to the main search so that it only returns events with the matching transaction ID. Normally subsearches aren't particularly fast, so as a general rule I wouldn't be suggesting them for optimization, but it will be far better than letting transaction operate on every single event with the my_log sourcetype.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:05:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-performance-and-optimization/m-p/105880#M27512</guid>
      <dc:creator>BenjaminWyatt</dc:creator>
      <dc:date>2020-09-28T14:05:28Z</dc:date>
    </item>
  </channel>
</rss>

