<?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: Can you help me with the following query using the join command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453630#M128368</link>
    <description>&lt;P&gt;try doing &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" OR index="index2" 
| eval SERIAL_NUMBER=coalesce(lower('SerialNum'),lower('Serial Number')) 
| eval Index1_SN=if(index="index1",SERIAL_NUMBER,null()) 
| eval Index2_SN=if(index="index2",SERIAL_NUMBER,null()) 
|stats values(Index1_SN) as Index1_SN values(Index2_SN) as Index2_SN count dc(Location) as locations values(Location) as Location by SERIAL_NUMBER
| eval Same_SN=if(Index1_SN=Index2_SN,1,0) 
|eval flag=case(Same_SN=1,1,Same_SN=0 AND locations&amp;gt;1,2,1=1,0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Oct 2018 21:18:23 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2018-10-29T21:18:23Z</dc:date>
    <item>
      <title>Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453625#M128363</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;

&lt;P&gt;I have a problem with a join between two indexes.&lt;/P&gt;

&lt;P&gt;For example, I have 2 values:  A and B, which are on both indexes. But, when I made my join, I saw only the value A and not B.&lt;/P&gt;

&lt;P&gt;My code :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" | eval SERIAL_NUMBER=lower('SerialNum') | eval Index1_SN=SERIAL_NUMBER | join type=left SERIAL_NUMBER 
[search index="index2" | eval SERIAL_NUMBER=lower('Serial Number') | eval Index2_SN=SERIAL_NUMBER] | eval Same_SN=if(like(Index1_SN,Index2_SN),1,0) | table Same_SN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's returning some answers but sometimes it's putting a "0" while the value is on 2 indexes.&lt;/P&gt;

&lt;P&gt;Thank you !&lt;/P&gt;

&lt;P&gt;Max&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 14:50:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453625#M128363</guid>
      <dc:creator>MaximeMoreau</dc:creator>
      <dc:date>2018-10-26T14:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453626#M128364</link>
      <description>&lt;P&gt;Any reason you using like and not = ?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 19:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453626#M128364</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-26T19:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453627#M128365</link>
      <description>&lt;P&gt;What's your requirement here??&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 19:35:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453627#M128365</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-10-26T19:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453628#M128366</link>
      <description>&lt;P&gt;Can you do this without the join command, perhaps? and as @Vijeta mentions, use &lt;CODE&gt;=&lt;/CODE&gt; instead of &lt;CODE&gt;like&lt;/CODE&gt; in the &lt;CODE&gt;if&lt;/CODE&gt; statement — unless they are not actually equal, in which case your join wouldn't have really worked in the first place. Some example data would be helpful. and just displaying a table of 1s and 0s might not tell you much? do you need to also display the serial number, as well?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" OR index="index2" | eval SERIAL_NUMBER=coalesce(lower('SerialNum'),lower('Serial Number')) | eval Index1_SN=if(index="index1",SERIAL_NUMBER,null()) | eval Index2_SN=if(index="index2",SERIAL_NUMBER,null()) |stats values(Index1_SN) as Index1_SN values(Index2_SN) as Index2_SN by SERIAL_NUMBER| eval Same_SN=if(Index1_SN=Index2_SN,1,0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also think if you're just trying to figure out if two serial numbers appear on both indexes and that's it, you could do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" OR index="index2" | eval SERIAL_NUMBER=coalesce(lower('SerialNum'),lower('Serial Number')) |stats dc(index) as indexes by SERIAL_NUMBER
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and be able to see if it's on 1 index or 2.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 20:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453628#M128366</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-10-26T20:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453629#M128367</link>
      <description>&lt;P&gt;Perfect that's work !&lt;/P&gt;

&lt;P&gt;I have an other problem due to this modification...&lt;/P&gt;

&lt;P&gt;If you want, I want to add the "Location" field, but sometimes I have more than 1 Location by SerialNumber (error I want to fix).&lt;/P&gt;

&lt;P&gt;I'm trying to make a count, but it's doesn't work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by SERIAL_NUMBER, Location | eval flag=if(Same_SN=1,1,if(Same_SN=0 and count&amp;gt;1,2,0))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you have an idea for how to count put 2 if I have more than 1 location ? Or have I to create a new "request" ?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Maxime.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 16:51:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453629#M128367</guid>
      <dc:creator>MaximeMoreau</dc:creator>
      <dc:date>2018-10-29T16:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453630#M128368</link>
      <description>&lt;P&gt;try doing &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" OR index="index2" 
| eval SERIAL_NUMBER=coalesce(lower('SerialNum'),lower('Serial Number')) 
| eval Index1_SN=if(index="index1",SERIAL_NUMBER,null()) 
| eval Index2_SN=if(index="index2",SERIAL_NUMBER,null()) 
|stats values(Index1_SN) as Index1_SN values(Index2_SN) as Index2_SN count dc(Location) as locations values(Location) as Location by SERIAL_NUMBER
| eval Same_SN=if(Index1_SN=Index2_SN,1,0) 
|eval flag=case(Same_SN=1,1,Same_SN=0 AND locations&amp;gt;1,2,1=1,0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Oct 2018 21:18:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453630#M128368</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-10-29T21:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453631#M128369</link>
      <description>&lt;P&gt;Perfect, thank you again.&lt;/P&gt;

&lt;P&gt;Normally it will be ok with this code.&lt;/P&gt;

&lt;P&gt;Have a nice day !&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 08:28:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453631#M128369</guid>
      <dc:creator>MaximeMoreau</dc:creator>
      <dc:date>2018-10-30T08:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following query using the join command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453632#M128370</link>
      <description>&lt;P&gt;If the answer provided solved your problem, could you please accept it so other readers can identify it is solved, award points, and essentially “close” the question, in a sense. Thanks! &lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 13:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-query-using-the-join-command/m-p/453632#M128370</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-10-30T13:13:00Z</dc:date>
    </item>
  </channel>
</rss>

