<?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: search using join command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169754#M48528</link>
    <description>&lt;P&gt;Do the main and subsearch both return the expected results when run separately?&lt;/P&gt;</description>
    <pubDate>Sun, 08 Dec 2013 22:14:13 GMT</pubDate>
    <dc:creator>joebensimo</dc:creator>
    <dc:date>2013-12-08T22:14:13Z</dc:date>
    <item>
      <title>search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169751#M48525</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I want to combine two different searches and each different field by using join command.&lt;BR /&gt;
However, I always get "No Results" whatever I tried.&lt;BR /&gt;
Please give me some advice.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;joinコマンドを利用して二つのサーチを繋げ、それぞれにある違うフィールドを掛け合わせたいのですが、上手くいきません。&lt;BR /&gt;
それぞれのデータ量が重いため、collect indexでインデックスを作成しながらやっても駄目でした。&lt;BR /&gt;
joinコマンドの正しい使い方をご教授下さい。&lt;/P&gt;

&lt;P&gt;index=A sourcetype=logs source!=XXX.csv id=1234 name=* | stats count by id number | join [search index=tarot | table number name main_type2] | stats count by id name main_type2 number | sort - count | head 20&lt;/P&gt;

&lt;P&gt;common field =&amp;gt; number&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:26:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169751#M48525</guid>
      <dc:creator>appleman</dc:creator>
      <dc:date>2020-09-28T15:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169752#M48526</link>
      <description>&lt;P&gt;Hi appleman &lt;/P&gt;

&lt;P&gt;I guess you need to mention the common field when using join something like this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=A sourcetype=logs&lt;BR /&gt;
source!=XXX.csv id=1234 name=* | stats&lt;BR /&gt;
count by id number | join &lt;STRONG&gt;number&lt;/STRONG&gt;&lt;BR /&gt;
[search index=tarot | table number&lt;BR /&gt;
name main_type2] | stats count by id&lt;BR /&gt;
name main_type2 number | sort - count&lt;BR /&gt;
| head 20&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:26:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169752#M48526</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2020-09-28T15:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169753#M48527</link>
      <description>&lt;P&gt;I've tried this, but it turned out to be no result.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2013 11:39:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169753#M48527</guid>
      <dc:creator>appleman</dc:creator>
      <dc:date>2013-12-08T11:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169754#M48528</link>
      <description>&lt;P&gt;Do the main and subsearch both return the expected results when run separately?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2013 22:14:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169754#M48528</guid>
      <dc:creator>joebensimo</dc:creator>
      <dc:date>2013-12-08T22:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169755#M48529</link>
      <description>&lt;P&gt;こんにちは。サーチ文だけからみると以下のような動きですがこれは求めている動きですか？&lt;/P&gt;

&lt;P&gt;メインサーチ：id（1234）、number、count&lt;BR /&gt;
サブサーチ： number、name、main_type2&lt;BR /&gt;
をnumberでJOINすると結果はnumberが一致するデータのみ（デフォルト）になります。&lt;BR /&gt;
id（1234固定）、（一致した）number、count、（サブサーチの）name、（サブサーチの）main_type2&lt;/P&gt;

&lt;P&gt;これをstats count by id name main_type2 number しているので&lt;BR /&gt;
id（1234固定）、（サブサーチの）name、（サブサーチの）main_type2、（一致した）number&lt;BR /&gt;
となり、結果はサブサーチの値のみで、メインサーチはサブサーチのデータからnumberが一致しないデータを除外するために使われているだけになります。&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:26:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169755#M48529</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-28T15:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169756#M48530</link>
      <description>&lt;P&gt;メインとサブサーチのnameは違うフィールドになります。従って結果として求めているものは、（メイン）nameに対するid、（サブ）name、main_type2、（一致した）numberになります。&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 01:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169756#M48530</guid>
      <dc:creator>appleman</dc:creator>
      <dc:date>2013-12-09T01:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169757#M48531</link>
      <description>&lt;P&gt;JOINの場合同じフィールド名はサブサーチの値で上書きです。どちらかをリネームする必要があります。このサーチは | stats count by id number の部分でメインサーチ側のnameはなくなってます。&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 01:22:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169757#M48531</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2013-12-09T01:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169758#M48532</link>
      <description>&lt;P&gt;サブサーチの値で上書きされる旨、認識しておらず勉強になりました。ありがとうございます。ただこちらの事情により、実際のサーチとはフィールド名を変えてAnswersに掲載させて頂いているのですが、実際のサーチでは、nameのフィールドはそれぞれ別々のフィールド名が与えてあります。&lt;BR /&gt;
idは値を指定しているので、固定になりますでしょうか。&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 01:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169758#M48532</guid>
      <dc:creator>appleman</dc:creator>
      <dc:date>2013-12-09T01:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169759#M48533</link>
      <description>&lt;P&gt;サブサーチの結果にidが存在しないので、idはメインサーチで指定されたidでかつサブサーチとnumberが一致するものとなります。メインサーチの| stats count by id number の部分でメインサーチ側のnameはなくなっているので気をつけて下さい。&lt;/P&gt;

&lt;P&gt;また、サブサーチを使うことでパフォーマンスがでないようなら、メインサーチで両方抽出してstatsでひとつにまとめるようなこともできると思います。&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 01:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169759#M48533</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2013-12-09T01:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169760#M48534</link>
      <description>&lt;P&gt;テストしてませんが、statsを使った例です。&lt;/P&gt;

&lt;P&gt;(index=A sourcetype=logs source!=XXX.csv id=1234) OR (index=tarot)&lt;BR /&gt;
|stats dc(index) as idx_cnt,first(sub_name) as name,first(main_type2) as main_type2 by id,number&lt;BR /&gt;
|where idx_cnt=2&lt;BR /&gt;
|stats count by id,name,main_type2,number | sort - count | head 20&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:26:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169760#M48534</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-28T15:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169761#M48535</link>
      <description>&lt;P&gt;if you are trying to have a reference from other source, try lookup.&lt;BR /&gt;
create temporary lookup file by&lt;/P&gt;

&lt;P&gt;... yoursearch | table fielda fieldb fieldc | outputlookup your_lookup.csv&lt;/P&gt;

&lt;P&gt;then, do a search with the lookup command to lookup fields you need to put together.&lt;BR /&gt;
* if your lookup file gets very big, then you can use lookup in DB using DB Connect.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2013 04:17:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169761#M48535</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2013-12-11T04:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169762#M48536</link>
      <description>&lt;P&gt;Speaking of lookup, can I use dblookup even though the data is not in the DB? I mean, the data is exported from other DB which I can't put it in DB connect.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2013 05:13:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169762#M48536</guid>
      <dc:creator>appleman</dc:creator>
      <dc:date>2013-12-11T05:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169763#M48537</link>
      <description>&lt;P&gt;Well, there is no dblookup command. And for lookup data in DB by DB connect app, then you have to have the data in DB. If you can not connect your original DB where you exported the data from, then use the exported CSV as lookup (file based), or put the exported data into other database which is accessible by your splunk and configure DB connect to do lookup in database.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2013 05:20:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169763#M48537</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2013-12-11T05:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: search using join command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169764#M48538</link>
      <description>&lt;P&gt;So basically, I need to put the data in DB which I can connect with DB connect.... Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2013 09:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-using-join-command/m-p/169764#M48538</guid>
      <dc:creator>appleman</dc:creator>
      <dc:date>2013-12-11T09:46:56Z</dc:date>
    </item>
  </channel>
</rss>

