<?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: Join 2 large tstats data sets in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59612#M14695</link>
    <description>&lt;P&gt;I'm not sure if my previous answer used to work or was simply incorrect. Tstats does work with union:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats summariesonly=false values(Authentication.tag) as tag, values(Authentication.app) as app, count(eval('Authentication.action'=="failure")) as failure, count(eval('Authentication.action'=="success")) as success from datamodel=Authentication by Authentication.src |union [tstats count from datamodel=Authentication BY Authentication.src ]    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So to rework the example above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(dst_ip) AS cdip FROM bad_traffic groupby protocol dst_port dst_ip | union [tstats  count(dst_ip) AS cdipt FROM all_traffic groupby protocol dst_port dst_ip src_ip] | stats sum(cdip) as cdip sum(cdipt) as cdipt values(src_ip) as src_ip by protocol dst_port dst_ip | search cdip&amp;gt;0 cdipt&amp;gt;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to make the source datamodel names explicit and rename, but that should be straightforward, either before the union, after it or inside the subsearch.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2017 00:53:01 GMT</pubDate>
    <dc:creator>dturnbull_splun</dc:creator>
    <dc:date>2017-12-06T00:53:01Z</dc:date>
    <item>
      <title>Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59606#M14689</link>
      <description>&lt;P&gt;I need to join two large tstats namespaces on multiple fields.  For example, I have these two tstats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(dst_ip) AS cdip FROM bad_traffic groupby protocol dst_port dst_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(dst_ip) AS cdipt FROM all_traffic groupby protocol dst_port dst_ip src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need all &lt;CODE&gt;src_ip&lt;/CODE&gt; fields from &lt;CODE&gt;all_traffic&lt;/CODE&gt; namespace where the &lt;CODE&gt;dst_ip&lt;/CODE&gt;, &lt;CODE&gt;dst_port&lt;/CODE&gt;, and &lt;CODE&gt;protocol&lt;/CODE&gt; of the &lt;CODE&gt;all_traffic&lt;/CODE&gt; entry match a &lt;CODE&gt;dst_ip&lt;/CODE&gt;, &lt;CODE&gt;dst_port&lt;/CODE&gt;, &lt;CODE&gt;protocol&lt;/CODE&gt; combination in the &lt;CODE&gt;bad_traffic&lt;/CODE&gt; namespace.  Effectively this gives a list of all the source ip for traffic that matches bad traffic.&lt;/P&gt;

&lt;P&gt;I read through the stats, tstats, and eval manuals, but I'm stuck on how to do this efficiently.  I can do it with a join on the two tstats commands above, but the datasets are so large it takes forever.  I considered doing a prestat and append on the tstats, but I can't seem to get the desired results this way.&lt;/P&gt;

&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2013 19:22:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59606#M14689</guid>
      <dc:creator>btorresgil</dc:creator>
      <dc:date>2013-09-10T19:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59607#M14690</link>
      <description>&lt;P&gt;How did you solve this issue?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Feb 2015 19:10:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59607#M14690</guid>
      <dc:creator>sanjay_shrestha</dc:creator>
      <dc:date>2015-02-16T19:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59608#M14691</link>
      <description>&lt;P&gt;I'd do it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(dst_ip) AS cdip FROM bad_traffic groupby protocol dst_port dst_ip | tstats append=true count(dst_ip) AS cdipt FROM all_traffic groupby protocol dst_port dst_ip src_ip | stats sum(cdip) as cdip sum(cdipt) as cdipt values(src_ip) as src_ip by protocol dst_port dst_ip | search cdip&amp;gt;0 cdipt&amp;gt;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does that give you what you want?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 10:52:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59608#M14691</guid>
      <dc:creator>dart</dc:creator>
      <dc:date>2015-02-27T10:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59609#M14692</link>
      <description>&lt;P&gt;I'm not able to replicate this.. You can't do append=true without prestats, and it doesn't seem like you can sum() a count() prestats clause (e.g., sum(cdip) where cdip = prestats count(dst_ip)). Does this work? &lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 15:28:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59609#M14692</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2015-12-09T15:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59610#M14693</link>
      <description>&lt;P&gt;Why is an answer that cannot even run accepted?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 05:10:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59610#M14693</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-05T05:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59611#M14694</link>
      <description>&lt;P&gt;@woodcock because some hero has yet to propose a better answer, I can only assume &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 05:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59611#M14694</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2017-12-05T05:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59612#M14695</link>
      <description>&lt;P&gt;I'm not sure if my previous answer used to work or was simply incorrect. Tstats does work with union:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats summariesonly=false values(Authentication.tag) as tag, values(Authentication.app) as app, count(eval('Authentication.action'=="failure")) as failure, count(eval('Authentication.action'=="success")) as success from datamodel=Authentication by Authentication.src |union [tstats count from datamodel=Authentication BY Authentication.src ]    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So to rework the example above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(dst_ip) AS cdip FROM bad_traffic groupby protocol dst_port dst_ip | union [tstats  count(dst_ip) AS cdipt FROM all_traffic groupby protocol dst_port dst_ip src_ip] | stats sum(cdip) as cdip sum(cdipt) as cdipt values(src_ip) as src_ip by protocol dst_port dst_ip | search cdip&amp;gt;0 cdipt&amp;gt;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to make the source datamodel names explicit and rename, but that should be straightforward, either before the union, after it or inside the subsearch.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 00:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59612#M14695</guid>
      <dc:creator>dturnbull_splun</dc:creator>
      <dc:date>2017-12-06T00:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59613#M14696</link>
      <description>&lt;P&gt;Sadly, I am not he, but I will followup here if I find him!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 02:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59613#M14696</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-13T02:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59614#M14697</link>
      <description>&lt;P&gt;Duncan is though! Scroll down but a little and you’ll see the new and improved answer.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 03:25:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59614#M14697</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2017-12-13T03:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59615#M14698</link>
      <description>&lt;P&gt;Perfect..!! worked like a charm. good logic.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 16:45:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59615#M14698</guid>
      <dc:creator>Sanjai676</dc:creator>
      <dc:date>2019-02-21T16:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 large tstats data sets</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59616#M14699</link>
      <description>&lt;P&gt;I downvoted this post because doesn't work&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 21:25:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-large-tstats-data-sets/m-p/59616#M14699</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2019-12-02T21:25:20Z</dc:date>
    </item>
  </channel>
</rss>

