<?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 How do you compare 2 fields in different indexes to add a third field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382487#M173882</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I can't find out how to do a search to compare the same value in 2 fields, and if this is same value, add a third field.&lt;/P&gt;

&lt;P&gt;For exemple:&lt;BR /&gt;
&lt;STRONG&gt;index1&lt;/STRONG&gt; with &lt;CODE&gt;field1Index1&lt;/CODE&gt; and &lt;CODE&gt;field2Index1&lt;/CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;index2&lt;/STRONG&gt; with &lt;CODE&gt;field1Index2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In the search, if &lt;CODE&gt;field1Index1&lt;/CODE&gt; = &lt;CODE&gt;field1Index2&lt;/CODE&gt; then display &lt;CODE&gt;field1Index1&lt;/CODE&gt; and &lt;CODE&gt;field2Index1&lt;/CODE&gt; &lt;BR /&gt;
NB: &lt;CODE&gt;field1Index1&lt;/CODE&gt; associated to &lt;CODE&gt;field2Index1&lt;/CODE&gt;in &lt;STRONG&gt;index1&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I found different subjects on the forum with eval, if... but not with all that conditions.&lt;/P&gt;

&lt;P&gt;Can you help me?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Dec 2018 13:28:45 GMT</pubDate>
    <dc:creator>ppiton</dc:creator>
    <dc:date>2018-12-28T13:28:45Z</dc:date>
    <item>
      <title>How do you compare 2 fields in different indexes to add a third field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382487#M173882</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I can't find out how to do a search to compare the same value in 2 fields, and if this is same value, add a third field.&lt;/P&gt;

&lt;P&gt;For exemple:&lt;BR /&gt;
&lt;STRONG&gt;index1&lt;/STRONG&gt; with &lt;CODE&gt;field1Index1&lt;/CODE&gt; and &lt;CODE&gt;field2Index1&lt;/CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;index2&lt;/STRONG&gt; with &lt;CODE&gt;field1Index2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In the search, if &lt;CODE&gt;field1Index1&lt;/CODE&gt; = &lt;CODE&gt;field1Index2&lt;/CODE&gt; then display &lt;CODE&gt;field1Index1&lt;/CODE&gt; and &lt;CODE&gt;field2Index1&lt;/CODE&gt; &lt;BR /&gt;
NB: &lt;CODE&gt;field1Index1&lt;/CODE&gt; associated to &lt;CODE&gt;field2Index1&lt;/CODE&gt;in &lt;STRONG&gt;index1&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I found different subjects on the forum with eval, if... but not with all that conditions.&lt;/P&gt;

&lt;P&gt;Can you help me?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 13:28:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382487#M173882</guid>
      <dc:creator>ppiton</dc:creator>
      <dc:date>2018-12-28T13:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you compare 2 fields in different indexes to add a third field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382488#M173883</link>
      <description>&lt;P&gt;Can you try this ?&lt;BR /&gt;
This will return results only if field1Index1=field1Index2&lt;/P&gt;

&lt;P&gt;| makeresults&lt;BR /&gt;
| eval field1Index1= 4&lt;BR /&gt;
| eval field2Index1= 7&lt;BR /&gt;
| eval field1Index2= 4&lt;BR /&gt;
| eval field1Index1New =case(field1Index1=field1Index2,field1Index1,field1Index2=field1Index1,field2Index1,1=0,0)&lt;BR /&gt;
| where field1Index1New!=""&lt;BR /&gt;
| table field2Index1  field1Index1New&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 14:17:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382488#M173883</guid>
      <dc:creator>saurabhkharkar</dc:creator>
      <dc:date>2018-12-28T14:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you compare 2 fields in different indexes to add a third field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382489#M173884</link>
      <description>&lt;P&gt;Ok but i don't need to set values 4 or 7.&lt;BR /&gt;
I need to use values of search.&lt;BR /&gt;
Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 14:33:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382489#M173884</guid>
      <dc:creator>ppiton</dc:creator>
      <dc:date>2018-12-28T14:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do you compare 2 fields in different indexes to add a third field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382490#M173885</link>
      <description>&lt;P&gt;yeah, all you have to use is &lt;/P&gt;

&lt;P&gt;index=index1 OR index=index2 &lt;BR /&gt;
| eval field1Index1New =case(field1Index1=field1Index2,field1Index1,field1Index2=field1Index1,field2Index1,1=0,0)&lt;BR /&gt;
| where field1Index1New!=""&lt;BR /&gt;
| table field2Index1 field1Index1New&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 14:38:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-compare-2-fields-in-different-indexes-to-add-a-third/m-p/382490#M173885</guid>
      <dc:creator>saurabhkharkar</dc:creator>
      <dc:date>2018-12-28T14:38:47Z</dc:date>
    </item>
  </channel>
</rss>

