<?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: Transaction very slow, use stats? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254852#M76313</link>
    <description>&lt;P&gt;Hello aljohnson,&lt;/P&gt;

&lt;P&gt;Thanks for your answer.&lt;/P&gt;

&lt;P&gt;I don't know why but the stats commands you gave me don't work... The search part is fast (like few sec), but the "finalize" part takes a looonnnggg time (like 15-30 minutes) for "No results found".&lt;/P&gt;

&lt;P&gt;By the way I read the talk you gave and I divide the time by &lt;STRONG&gt;5&lt;/STRONG&gt; !! So really thanks for that.&lt;BR /&gt;
But I'm really curious about using stats instead of transaction. I think the mvexpand really slow the process...&lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
I think you meant:&lt;BR /&gt;
&lt;CODE&gt;| stats list(from) as from, values(uid) as uuid by id&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;That's why I didn't got any result. But anyway the mvexpand is very long (45 sec without, an hour with)&lt;/P&gt;</description>
    <pubDate>Mon, 05 Oct 2015 12:12:22 GMT</pubDate>
    <dc:creator>aq_natixis</dc:creator>
    <dc:date>2015-10-05T12:12:22Z</dc:date>
    <item>
      <title>Transaction very slow, use stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254850#M76311</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following logs (1 line = 1 event):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id=**10** from="**10.10.10.44**"
id=10 ### whatever useless log ###
id=**10** bind uid="**toto**"
id=10 ### whatever useless log ###
id=**20** from="**10.10.10.55**"
id=20 ### whatever useless log ###
id=**20** bind uid="**tata**"
id=10 ### whatever useless log ###
id=20 ### whatever useless log ###
id=**30** from="**10.10.10.44**"
id=30 ### whatever useless log ###
id=**30** bind uid="**titi**"
id=30 ### whatever useless log ###
id=**30** bind uid="**toto**"
id=30 ### whatever useless log ###
id=20 ### whatever useless log ###
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the table result I want :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;uid from    count
toto    10.10.10.44 2
tata    10.10.10.55 1
titi    10.10.10.44 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the search I use to get my result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(...) "bind uid" OR "from"| transaction id startswith="from" | mvexpand uid | stats count by uid,from
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have exactly the result I want, but the search is VERY slow to perform. A lot of time is used to do the transaction.&lt;/P&gt;

&lt;P&gt;So how I can improve my search, or how I can use stats instead of transaction?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 12:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254850#M76311</guid>
      <dc:creator>aq_natixis</dc:creator>
      <dc:date>2015-10-01T12:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction very slow, use stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254851#M76312</link>
      <description>&lt;P&gt;Its not just stats, but stats on stats on stats!  At least this is how I would do it.&lt;/P&gt;

&lt;P&gt;If this part of your search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; "bind uid" OR "from"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;gets you the events you want so that they're ordered like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; id=**10** from="**10.10.10.44**"
 id=**10** bind uid="**toto**"
 id=**20** from="**10.10.10.55**"
 id=**20** bind uid="**tata**"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should just be able use the &lt;CODE&gt;id&lt;/CODE&gt; field to group them.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats list(from) as from, values(uid) as uid by id
| stats count by uid from id
| stats sum(count) as count by uuid, from
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Your question was also a broad one - how can I improve this search?&lt;/P&gt;

&lt;P&gt;Check out this &lt;A href="http://conf.splunk.com/session/2015/conf2015_JHarty_DuncanTurnbull_Splunk_UsingSplunkSearchLanguage_AQuickGuideToSearch.pdf"&gt;awesome talk&lt;/A&gt; given at &lt;CODE&gt;.conf2015&lt;/CODE&gt; by Duncan Turnbull &amp;amp; Julian Harty. Here are a few takeaways:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;use appropriate time range : speed up 30x - 365x&lt;/LI&gt;
&lt;LI&gt;add index=foo sourcetype=bar and other metafields : speed up 2x - 10x&lt;/LI&gt;
&lt;LI&gt;use the appropriate search mode (fast &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; : speed up 2x - 5x&lt;/LI&gt;
&lt;LI&gt;avoid not &amp;amp; other exclusionary searches (e.g. &lt;CODE&gt;!=&lt;/CODE&gt;) : speedup 2x - 20x&lt;/LI&gt;
&lt;LI&gt;use the fields command early in your search to ONLY get the fields you need&lt;/LI&gt;
&lt;LI&gt;avoid subsearches&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 02 Oct 2015 14:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254851#M76312</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-10-02T14:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction very slow, use stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254852#M76313</link>
      <description>&lt;P&gt;Hello aljohnson,&lt;/P&gt;

&lt;P&gt;Thanks for your answer.&lt;/P&gt;

&lt;P&gt;I don't know why but the stats commands you gave me don't work... The search part is fast (like few sec), but the "finalize" part takes a looonnnggg time (like 15-30 minutes) for "No results found".&lt;/P&gt;

&lt;P&gt;By the way I read the talk you gave and I divide the time by &lt;STRONG&gt;5&lt;/STRONG&gt; !! So really thanks for that.&lt;BR /&gt;
But I'm really curious about using stats instead of transaction. I think the mvexpand really slow the process...&lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
I think you meant:&lt;BR /&gt;
&lt;CODE&gt;| stats list(from) as from, values(uid) as uuid by id&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;That's why I didn't got any result. But anyway the mvexpand is very long (45 sec without, an hour with)&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 12:12:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254852#M76313</guid>
      <dc:creator>aq_natixis</dc:creator>
      <dc:date>2015-10-05T12:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction very slow, use stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254853#M76314</link>
      <description>&lt;P&gt;Hi @aq_natixis&lt;/P&gt;

&lt;P&gt;1.) Yes, you caught my typo, oops&lt;/P&gt;

&lt;P&gt;2.) Is mvexpand the slow portion? It very well may be. Try taking them out ! I think it should still work. I will remove them from my answer. and correct the other typo.&lt;/P&gt;

&lt;P&gt;3.) Check the job inspector. This will tell you what is slow.&lt;/P&gt;

&lt;P&gt;4.) Great talk - I'm glad it helped !!&lt;/P&gt;

&lt;P&gt;5.) If this fixed your issue, please accept the answer.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 23:15:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-very-slow-use-stats/m-p/254853#M76314</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-10-05T23:15:15Z</dc:date>
    </item>
  </channel>
</rss>

