<?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 Matching values in fields from multiple sources in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108590#M1607</link>
    <description>&lt;P&gt;I have two different sources, &lt;EM&gt;blacklisted&lt;/EM&gt; and &lt;EM&gt;log&lt;/EM&gt;. &lt;EM&gt;blacklisted&lt;/EM&gt; source contains all the blacklisted IP Addresses, and &lt;EM&gt;log&lt;/EM&gt; source contains network information of potential sources.&lt;/P&gt;

&lt;P&gt;Below is the search command i use, together with the results obtained.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _* | fields blacklisted,SRC 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results: &lt;A href="http://tinypic.com/r/11mc5z8/5"&gt;http://tinypic.com/r/11mc5z8/5&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What i need to do is to compare the two fields and display which are the IP address that matches, in order words, which IP address in my &lt;EM&gt;log&lt;/EM&gt; matches the blacklisted IP address in my &lt;EM&gt;blacklisted&lt;/EM&gt;.&lt;/P&gt;

&lt;P&gt;What i tried doing to get the matching field is to use the below command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _* | fields blacklisted,SRC | eval matches=if(blacklisted==SRC, "match", "no match") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results: &lt;A href="http://tinypic.com/r/10e1q2b/5"&gt;http://tinypic.com/r/10e1q2b/5&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What i assume is that they are matching the field &lt;EM&gt;SRC&lt;/EM&gt; which is null, to the field &lt;EM&gt;blacklisted&lt;/EM&gt;, and therefore, return no matches.&lt;/P&gt;

&lt;P&gt;May i ask if there is any suggestion to solve this problem?&lt;/P&gt;

&lt;P&gt;Thank You.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2013 11:50:02 GMT</pubDate>
    <dc:creator>Zyon</dc:creator>
    <dc:date>2013-07-29T11:50:02Z</dc:date>
    <item>
      <title>Matching values in fields from multiple sources</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108590#M1607</link>
      <description>&lt;P&gt;I have two different sources, &lt;EM&gt;blacklisted&lt;/EM&gt; and &lt;EM&gt;log&lt;/EM&gt;. &lt;EM&gt;blacklisted&lt;/EM&gt; source contains all the blacklisted IP Addresses, and &lt;EM&gt;log&lt;/EM&gt; source contains network information of potential sources.&lt;/P&gt;

&lt;P&gt;Below is the search command i use, together with the results obtained.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _* | fields blacklisted,SRC 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results: &lt;A href="http://tinypic.com/r/11mc5z8/5"&gt;http://tinypic.com/r/11mc5z8/5&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What i need to do is to compare the two fields and display which are the IP address that matches, in order words, which IP address in my &lt;EM&gt;log&lt;/EM&gt; matches the blacklisted IP address in my &lt;EM&gt;blacklisted&lt;/EM&gt;.&lt;/P&gt;

&lt;P&gt;What i tried doing to get the matching field is to use the below command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _* | fields blacklisted,SRC | eval matches=if(blacklisted==SRC, "match", "no match") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results: &lt;A href="http://tinypic.com/r/10e1q2b/5"&gt;http://tinypic.com/r/10e1q2b/5&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What i assume is that they are matching the field &lt;EM&gt;SRC&lt;/EM&gt; which is null, to the field &lt;EM&gt;blacklisted&lt;/EM&gt;, and therefore, return no matches.&lt;/P&gt;

&lt;P&gt;May i ask if there is any suggestion to solve this problem?&lt;/P&gt;

&lt;P&gt;Thank You.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 11:50:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108590#M1607</guid>
      <dc:creator>Zyon</dc:creator>
      <dc:date>2013-07-29T11:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values in fields from multiple sources</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108591#M1608</link>
      <description>&lt;P&gt;Sounds to me like you should be setting up a lookup containing your blacklisted IP addresses, and then match using that lookup. I'm not really following how your current searches are meant to work - I suspect that you're confusing how some things work in Splunk.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 12:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108591#M1608</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-07-29T12:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values in fields from multiple sources</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108592#M1609</link>
      <description>&lt;P&gt;Oh thanks! I think i know how to make it work. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 14:44:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Matching-values-in-fields-from-multiple-sources/m-p/108592#M1609</guid>
      <dc:creator>Zyon</dc:creator>
      <dc:date>2013-07-29T14:44:06Z</dc:date>
    </item>
  </channel>
</rss>

