<?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: Return matching fields from two sources in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56090#M13706</link>
    <description>&lt;P&gt;Well, in your subsearch, you are using the field "last1" - it needs to be "last", just like the outer search.  Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1 
| eval names=split(Name," ") | eval last=mvindex(names,-1) | eval last=trim(lower(last))
| fields last Group_Name 
| join last 
    [search sourcetype="csv-2" 
    | eval names1=split(Name,", ") | eval last=mvindex(names1,0) | eval last=trim(lower(last))
    | fields last ]
| table last Group_Name
| rename last as "Last Name" Group_Name as "Group Name"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Sep 2012 05:31:04 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-09-11T05:31:04Z</dc:date>
    <item>
      <title>Return matching fields from two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56089#M13705</link>
      <description>&lt;P&gt;I have two different sources that I need to find and return all matching instances of a field. Unfortunately, the fields both represent a name, but in different formats. I have tried multiple incarnations of match, subsearches and joins and cannot get it to work.&lt;/P&gt;

&lt;P&gt;Sample source one. This is from a csv file. The headers are &lt;EM&gt;Name,Permissions,Domain,Group_Name&lt;/EM&gt;. And the host name would be server1 and sourcetype is csv-1.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Chris Powell,Full,TESTING,Domain Admin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample source two is more csv data. The headers are &lt;EM&gt;Name,Title,Department Description,Manager,Hire Date,Term Date,Location&lt;/EM&gt;. The sourcetype is csv-2. Host name is server2.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"POWELL, CHRISTOPHER",KEYBOARD MONKEY,IT,"PILSON, BOB",4/16/12, ,Hollywood - CA
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tried a few different queries along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1 | eval names=split(Name," ") | eval last=mvindex(names,-1) | eval last=lower(last) | table last Group_Name | join last [search sourcetype="csv-2" | eval names1=split(Name,", ") | eval last1=mvindex(names1,0) | eval last1=lower(last1) | table last1]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to return the matching names and the Group_Name along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Name               Group_Name
powell             Domain_Admin
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Sep 2012 23:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56089#M13705</guid>
      <dc:creator>cpowell</dc:creator>
      <dc:date>2012-09-10T23:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Return matching fields from two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56090#M13706</link>
      <description>&lt;P&gt;Well, in your subsearch, you are using the field "last1" - it needs to be "last", just like the outer search.  Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=server1 
| eval names=split(Name," ") | eval last=mvindex(names,-1) | eval last=trim(lower(last))
| fields last Group_Name 
| join last 
    [search sourcetype="csv-2" 
    | eval names1=split(Name,", ") | eval last=mvindex(names1,0) | eval last=trim(lower(last))
    | fields last ]
| table last Group_Name
| rename last as "Last Name" Group_Name as "Group Name"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2012 05:31:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56090#M13706</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-09-11T05:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Return matching fields from two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56091#M13707</link>
      <description>&lt;P&gt;Each search individually returns the correct lowercase last name, but the join is not returning anything.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2012 17:59:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56091#M13707</guid>
      <dc:creator>cpowell</dc:creator>
      <dc:date>2012-09-11T17:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Return matching fields from two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56092#M13708</link>
      <description>&lt;P&gt;Answer updated to including trimming white space fromt he last name...&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2012 17:12:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-matching-fields-from-two-sources/m-p/56092#M13708</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-09-21T17:12:23Z</dc:date>
    </item>
  </channel>
</rss>

