<?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 two fields within the same index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242304#M188968</link>
    <description>&lt;P&gt;Remove the &lt;CODE&gt;Source_Address="xx.xx.xxx"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2016 01:56:35 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-08-23T01:56:35Z</dc:date>
    <item>
      <title>Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242299#M188963</link>
      <description>&lt;P&gt;From one single index, there contains the following four fields, &lt;EM&gt;Source, Name, EquivalentName&lt;/EM&gt; (part of the records under &lt;EM&gt;EquivalentName&lt;/EM&gt; having the same data as the field, &lt;EM&gt;Name&lt;/EM&gt;) and &lt;EM&gt;Result&lt;/EM&gt;.&lt;BR /&gt;
&lt;EM&gt;Source          Name            EquivalentName          Result&lt;/EM&gt;&lt;BR /&gt;
A                     1$                     [blank]                         [blank]&lt;BR /&gt;
B                     2$                     [blank]                         [blank]&lt;BR /&gt;&lt;BR /&gt;
C                     2$                     [blank]                         [blank]&lt;BR /&gt;
D                     5$                     [blank]                         [blank]&lt;BR /&gt;
[blank]        [blank]                   1                                  X&lt;BR /&gt;
[blank]        [blank]                   2                                  Y&lt;BR /&gt;
[blank]        [blank]                   3                                  Z&lt;BR /&gt;
[blank]        [blank]                   4                                  W&lt;/P&gt;

&lt;P&gt;The end result: I would like to retrieve the list of &lt;EM&gt;Result&lt;/EM&gt; when searching for a list of &lt;EM&gt;Source&lt;/EM&gt; name.&lt;/P&gt;

&lt;P&gt;My query looks like this&lt;/P&gt;

&lt;P&gt;index=INDEX1 Source_Address="xx.xx.xxx" |rex field=Name mode=sed "s/\$//g" |table Source, Name |dedup Name|join Name[|search index=INDEX1 |where condition |rename EquivalentName as Name] |table Name, Result&lt;/P&gt;

&lt;P&gt;I do not get any results from this. However, when i break down the codes into two queries and retrieve 'manual', i am able to find some results. Not sure what went wrong. Kindly advise, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 15:49:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242299#M188963</guid>
      <dc:creator>LIUJIEER</dc:creator>
      <dc:date>2016-08-22T15:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242300#M188964</link>
      <description>&lt;P&gt;It might be that you are using &lt;CODE&gt;|table&lt;/CODE&gt; early on in the query. I think subsiquent commands will only have the data from the table to work with. So basically you are removing "EquivalentName" and "Result" early on in your search.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 19:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242300#M188964</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2016-08-22T19:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242301#M188965</link>
      <description>&lt;P&gt;Also, I might not understand fully, but if say I have have field1 and field2 and I need them to display as field3 I use this little bit of code.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval FIELD3=field1."-".field2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which returns a new field that looks like  field1-field2&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2016 19:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242301#M188965</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2016-08-22T19:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242302#M188966</link>
      <description>&lt;P&gt;How about something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX1 Source_Address="xx.xx.xxx" |rex field=Name mode=sed "s/\$//g" | where Name=EquivalentName | stats values(Result) as Result) by Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX1 Source_Address="xx.xx.xxx" |rex field=Name mode=sed "s/\$//g" | where Name=EquivalentName | dedup Name | table Name Results
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Aug 2016 19:08:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242302#M188966</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-22T19:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242303#M188967</link>
      <description>&lt;P&gt;this does not work because  with the Source_Address="xx.xx.xxx", the rows with &lt;EM&gt;Source&lt;/EM&gt; as [blank] are filtered out. Left with rows with only &lt;EM&gt;Name&lt;/EM&gt; filled and &lt;EM&gt;EquivalentName&lt;/EM&gt; as [blank]. Therefore, when we do where name=equivalentname will not return any rows&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 01:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242303#M188967</guid>
      <dc:creator>LIUJIEER</dc:creator>
      <dc:date>2016-08-23T01:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242304#M188968</link>
      <description>&lt;P&gt;Remove the &lt;CODE&gt;Source_Address="xx.xx.xxx"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 01:56:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242304#M188968</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-23T01:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242305#M188969</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX1 | rex field=Name mode=sed "s/\$//g" | eval Equivalent=if(Source_Address="xx.xx.xxx", Name, Equivalent) |  where Name=EquivalentName | stats values(Result) as Result) by Name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Aug 2016 11:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242305#M188969</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-23T11:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Join two fields within the same index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242306#M188970</link>
      <description>&lt;P&gt;I realized that when i do a&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX1 Source="*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;instead of looking for the specific source using&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=INDEX1 Source="xx.xx.xxx"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My original query has some output. But not all sources are displayed.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 15:23:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-fields-within-the-same-index/m-p/242306#M188970</guid>
      <dc:creator>LIUJIEER</dc:creator>
      <dc:date>2016-08-23T15:23:30Z</dc:date>
    </item>
  </channel>
</rss>

