<?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: How can we print all fields from a join by stats command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261636#M78531</link>
    <description>&lt;P&gt;@Genti&lt;/P&gt;

&lt;P&gt;No luck with &lt;CODE&gt;| stats dc(index) as dc values()  by primary_key_claim&lt;/CODE&gt; -- I hope this is what you mean.&lt;/P&gt;

&lt;P&gt;Same &lt;CODE&gt;com.splunk.mr.JobStartException&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 23 Oct 2016 03:28:18 GMT</pubDate>
    <dc:creator>ddrillic</dc:creator>
    <dc:date>2016-10-23T03:28:18Z</dc:date>
    <item>
      <title>How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261620#M78515</link>
      <description>&lt;P&gt;We have the following working query -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index= primary_claim     amt &amp;gt; 1000                ) OR 
(index=secondary_claim    admis_dt&amp;gt;="2015-10*"      )
| fields primary_key_claim index
| stats dc(index) as dc by primary_key_claim 
| search dc&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It runs on a 1/3 billion events table and 60 million secondary table just fine.&lt;BR /&gt;
We would like to print all the fields from both tables into a lookup for the joined set of 1.2 million events. &lt;/P&gt;

&lt;P&gt;Any ideas how to do that?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261620#M78515</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-20T14:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261621#M78516</link>
      <description>&lt;P&gt;You can add them in your fields and stats command. &lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:26:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261621#M78516</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-20T14:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261622#M78517</link>
      <description>&lt;P&gt;Do you just want the field name? Have tried the &lt;CODE&gt;fieldsummary&lt;/CODE&gt; command? Or you can try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats dc(index) as dc latest(*) as * by primary_key_claim
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Followed by &lt;CODE&gt;| outputlookup ...&lt;/CODE&gt; command&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:32:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261622#M78517</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-20T14:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261623#M78518</link>
      <description>&lt;P&gt;Great.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index= primary_claim      amt &amp;gt; 1000                ) OR 
 (index= secondary_claim    admis_dt&amp;gt;="2015-10*"      )
 | fields primary_key_claim index fieldX
 | stats dc(index) as dc by primary_key_claim 
 | search dc&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, I added &lt;CODE&gt;fieldX&lt;/CODE&gt; to the &lt;CODE&gt;fields&lt;/CODE&gt; command. Where do I add it to the &lt;CODE&gt;stats&lt;/CODE&gt; command?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:32:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261623#M78518</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-20T14:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261624#M78519</link>
      <description>&lt;P&gt;You see, each table has hundreds of fields and I would like to have in the lookup the entire set of fields from the combined two tables.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261624#M78519</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-20T14:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261625#M78520</link>
      <description>&lt;P&gt;Remove the fields command from your query and try the &lt;CODE&gt;| stats dc(index) as dc latest(*) as * by primary_key_claim&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:42:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261625#M78520</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-20T14:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261626#M78521</link>
      <description>&lt;P&gt;add to stats as &lt;CODE&gt;values(FieldX) as fieldX&lt;/CODE&gt;. Other options could be first/last/latest/earliest  instead of values.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261626#M78521</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-20T14:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261627#M78522</link>
      <description>&lt;P&gt;Perfect - let me try...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261627#M78522</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-20T14:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261628#M78523</link>
      <description>&lt;P&gt;Interesting, I'll try...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 14:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261628#M78523</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-20T14:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261629#M78524</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;(index= primary_claim      amt &amp;gt; 1000                ) OR 
  (index= secondary_claim    admis_dt&amp;gt;="2015-10*"      )
  | stats dc(index) as dc values(*) as * by primary_key_claim 
  | search dc&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Oct 2016 18:04:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261629#M78524</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2016-10-20T18:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261630#M78525</link>
      <description>&lt;P&gt;Try something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index= primary_claim   amt &amp;gt; 1000  ) OR    (index= secondary_claim  admis_dt&amp;gt;="2015-10*"  )
| stats dc(index) as dc values(*) as * by primary_key_claim 
| search dc&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Oct 2016 18:08:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261630#M78525</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-10-20T18:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261631#M78526</link>
      <description>&lt;P&gt;First of all, we have to agree on terminology.&lt;/P&gt;

&lt;P&gt;Using an OR is not the same as Joining data.  Joining data uses the join command usually.  OR is just a boolean operator saying "I want this data OR this data".   Such as "host=abc OR host=def".  Which would be different from "host=abc AND host=def" because you're typically not going to find events with two host names that are different like that.    The same search with joining would look more like this "host=abc | join commonFieldName [ search host=def]".  In such an example the join command would use the commonFieldName as a primary key to join the two sets of data with.&lt;/P&gt;

&lt;P&gt;So now that's out of the way...&lt;/P&gt;

&lt;P&gt;If you're looking to find ALL of the fields that could be found in either data source this would work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index= primary_claim amt &amp;gt; 1000) OR  (index= secondary_claim admis_dt&amp;gt;="2015-10*" ) | fieldsummary | table field | transpose 1000 | outputlookup fieldsByColumn.csv

OR this works as well (just depends if you\'re looking for single column lookup file or not)

(index= primary_claim amt &amp;gt; 1000) OR  (index= secondary_claim admis_dt&amp;gt;="2015-10*" ) | fieldsummary | table field | outputlookup fieldsByRow.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, perhaps this is not what you want at all... but you'd have to rephrase your question if so because this is what I believe you wanted when you said "We would like to print all the fields from both tables into a lookup for the joined set of 1.2 million events.".&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 18:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261631#M78526</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-10-20T18:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261632#M78527</link>
      <description>&lt;P&gt;Actually, the OR above with the way the stats has been build will do the "joining" as desired.&lt;BR /&gt;
if you have, name, age in one index, and name, gender in the other index, and if you do &lt;BR /&gt;
index1 OR index2, you get two events:&lt;BR /&gt;
Name, Age&lt;BR /&gt;
Name, Gender&lt;/P&gt;

&lt;P&gt;then the | stats dc(index) as dc values(*) as * by Name would return:&lt;BR /&gt;
Name, Age, Gender, 2&lt;BR /&gt;
the | search dc&amp;gt;1 then would return only those Names that are present in both indexes, and both Age and Gender show up, which is "All of the fields" from both indexes.&lt;/P&gt;

&lt;P&gt;eventually, this is a join, but done via the stats command. it will return what question asked for.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 18:38:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261632#M78527</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2016-10-20T18:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261633#M78528</link>
      <description>&lt;P&gt;Wow, learn something new every day!&lt;/P&gt;

&lt;P&gt;Thanks for the correction... i just dont understand how it works this way... but it does...&lt;/P&gt;

&lt;P&gt;I thought events would stream through, each with dc(index) equaling to 1, but apparently thats not how it works at all &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;  Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 11:58:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261633#M78528</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-10-21T11:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261634#M78529</link>
      <description>&lt;P&gt;It totally blows up my computer when I try to do it too.  Seems pretty intense.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 12:00:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261634#M78529</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-10-21T12:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261635#M78530</link>
      <description>&lt;P&gt;@sundareshr &lt;/P&gt;

&lt;P&gt;Trying - &lt;CODE&gt;| stats dc(index) as dc latest(*) as * by primary_key_claim&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I get a &lt;CODE&gt;com.splunk.mr.JobStartException&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;@Genti &lt;/P&gt;

&lt;P&gt;Trying &lt;CODE&gt;| stats dc(index) as dc values(*) as * by primary_key_claim&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Also here we get &lt;CODE&gt;com.splunk.mr.JobStartException&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 02:50:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261635#M78530</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-23T02:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261636#M78531</link>
      <description>&lt;P&gt;@Genti&lt;/P&gt;

&lt;P&gt;No luck with &lt;CODE&gt;| stats dc(index) as dc values()  by primary_key_claim&lt;/CODE&gt; -- I hope this is what you mean.&lt;/P&gt;

&lt;P&gt;Same &lt;CODE&gt;com.splunk.mr.JobStartException&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 03:28:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261636#M78531</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-23T03:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261637#M78532</link>
      <description>&lt;P&gt;im not familiar with: com.splunk.mr.*&lt;BR /&gt;
however, most google searches in relation to this return something in relation to map reduce - i.e., hadoop, i.e., Hunk.&lt;/P&gt;

&lt;P&gt;are you using Hunk? still, there should be no reason why the search would return things before the | stats  but not after.&lt;/P&gt;

&lt;P&gt;so, unto troubleshooting.&lt;BR /&gt;
what happens if you run | stats dc(index) by &lt;BR /&gt;
do you get results or same errors?&lt;/P&gt;

&lt;P&gt;what if you add one ore two fields at a time i.e., &lt;BR /&gt;
| stats dc(index) as dc values(field1) as field1 values(field2) as field2 by &lt;/P&gt;

&lt;P&gt;lastly, how many fields would it return? is it possible you have too many columns?/fields?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 03:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261637#M78532</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2016-10-23T03:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261638#M78533</link>
      <description>&lt;P&gt;Right, I'm using Hunk.&lt;/P&gt;

&lt;P&gt;You said - &lt;/P&gt;

&lt;P&gt;-- if you run &lt;CODE&gt;| stats dc(index) by .... cos_clm_head_sys_id&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;When running -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index= primary_claim     amt &amp;gt; 1000                ) OR 
 (index=secondary_claim    admis_dt&amp;gt;="2015-10*"      )
 | fields primary_key_claim index
 | stats dc(index) as dc by primary_key_claim 
 | search dc&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get 1.2 million events. &lt;/P&gt;

&lt;P&gt;I'm trying now -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     (index= primary_claim     amt &amp;gt; 1000                ) OR 
     (index=secondary_claim    admis_dt&amp;gt;="2015-10*"      )
     | fields primary_key_claim index
     | stats dc(index) as dc values(diag_cd) as diag_cd by primary_key_claim 
     | search dc&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It finishes just fine but the diag_cd column is empty.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 21:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261638#M78533</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-23T21:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can we print all fields from a join by stats command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261639#M78534</link>
      <description>&lt;P&gt;Trying the lookup way -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index= primary_claim     amt &amp;gt; 1000                ) OR 
 (index=secondary_claim    admis_dt&amp;gt;="2015-10*"      )
 | fields primary_key_claim index
 | stats dc(index) as dc by primary_key_claim 
 | search dc&amp;gt;1
 | outputlookup append=false claims_ids.csv.gz
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It created a relatively small lookup of 3.6 MBs of 1.2 million ids.&lt;/P&gt;

&lt;P&gt;What would be a good way to generate a lookup (or any other object) of the joined two tables?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 17:09:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-we-print-all-fields-from-a-join-by-stats-command/m-p/261639#M78534</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-10-26T17:09:33Z</dc:date>
    </item>
  </channel>
</rss>

