<?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: Using lookups against multiple sources (with differing field names for the same value) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191468#M55126</link>
    <description>&lt;P&gt;A better way to do what &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/38103"&gt;@Arun_N_007&lt;/a&gt; suggests is to use the &lt;CODE&gt;coalesce&lt;/CODE&gt; function, which will allow you to collapse two differently-named fields into one depending on their existence in one sourcetype or another:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=source1 OR sourcetype=source2
| eval Address=coalesce(srcip,source-address)
| lookup Lookup.csv Address ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Sep 2020 19:55:54 GMT</pubDate>
    <dc:creator>aweitzman</dc:creator>
    <dc:date>2020-09-28T19:55:54Z</dc:date>
    <item>
      <title>Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191461#M55119</link>
      <description>&lt;P&gt;Hi, I'm looking for an explanation of the best/most efficient way to perform a lookup against multiple sources/field names. I have a lookup table with a bunch of IP addresses that I want to find evidence of in logs.&lt;BR /&gt;
e.g.&lt;BR /&gt;
lookup : IPaddresses&lt;BR /&gt;
sourcetype: source1  fieldname=src_ip&lt;BR /&gt;
sourcetype: source2  fieldname=source_address&lt;/P&gt;

&lt;P&gt;I've tried various methiods but I can't seem to get what I'm looking for!&lt;BR /&gt;
TIA.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:55:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191461#M55119</guid>
      <dc:creator>neilsmith2</dc:creator>
      <dc:date>2020-09-28T19:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191462#M55120</link>
      <description>&lt;P&gt;Hi Neil,&lt;/P&gt;

&lt;P&gt;Could you please give Sample data in lookup and sourcetypes in table format???&lt;/P&gt;

&lt;P&gt;While using lookup commands you can use aliasing like&lt;/P&gt;

&lt;P&gt;Table A -&amp;gt; Lookup&lt;/P&gt;

&lt;P&gt;|lookup File.csv field as field1&lt;/P&gt;

&lt;P&gt;where field1 will be the filed of Table A.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 08:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191462#M55120</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2015-05-20T08:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191463#M55121</link>
      <description>&lt;P&gt;Hi Arun, thanks for the reply. Sure please see below (I have obfuscated the actual IP addresses/hostnames etc but the format remains the same). So I am trying to match values in the Address field in lookup.csv to the srcip field in source1 and/or the source_address field in source2&lt;/P&gt;

&lt;P&gt;Lookup.csv&lt;BR /&gt;
Address         Time                Attack&lt;BR /&gt;
1.1.1.1 15/05/2015 09:07    test1&lt;BR /&gt;
1.1.1.2 14/05/2015 00:43    test2&lt;BR /&gt;
1.1.1.3 13/05/2015 09:07    RA SCAN Unusually fast Terminal Server Traffic Inbound&lt;BR /&gt;
1.1.1.4 14/05/2015 13:44    Sipvicious Scan&lt;BR /&gt;
1.1.1.5 16/05/2015 18:47    source disclosure vulnerability&lt;BR /&gt;
1.1.1.6 03/05/2015 09:21    Sipvicious Scan&lt;/P&gt;

&lt;P&gt;Source1 sample event&lt;BR /&gt;
May 20 09:20:24 hostname auditd: date="2015-05-20 09:20:24 +0000",fac=f_kernel_ipfilter,area=a_general_area,type=t_nettraffic,pri=p_major,hostname=hostname.nm,event="session end",application=All-TCP-UDP-clustername-cluster,netsessid=abb23555c51bf,srcip=1.1.1.3,srcport=61759,srczone=vlan1674,protocol=6,dstip=10.10.10.10,dstport=3424,dstzone=vlan1,bytes_written_to_client=69500,bytes_written_to_server=6372,rule_name=permit-any-any,cache_hit=0,start_time="2015-05-20 09:19:59 +0000"&lt;/P&gt;

&lt;P&gt;Source2 sample event&lt;BR /&gt;
May 20 09:25:48 172.1.1.1 1 2015-05-20T10:25:48.243 hostname RT_FLOW - RT_FLOW_SESSION_CLOSE [junos@osversion reason="TCP FIN" source-address="1.1.1.5" source-port="50764" destination-address="10.1.1.1" destination-port="55551" service-name="None" nat-source-address="10.1.1.0" nat-source-port="50764" nat-destination-address="101.1.0" nat-destination-port="55551" src-nat-rule-name="None" dst-nat-rule-name="None" protocol-id="6" policy-name="policyname" source-zone-name="zonename" destination-zone-name="zonename2" session-id-32="43321" packets-from-client="19" bytes-from-client="10098" packets-from-server="17" bytes-from-server="3188" elapsed-time="3" application="UNKNOWN" nested-application="UNKNOWN" username="N/A" roles="N/A" packet-incoming-interface="reth1.0"]&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191463#M55121</guid>
      <dc:creator>neilsmith2</dc:creator>
      <dc:date>2020-09-28T19:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191464#M55122</link>
      <description>&lt;P&gt;Hi Neil,&lt;/P&gt;

&lt;P&gt;While Joining with Source1 it should be like,&lt;/P&gt;

&lt;P&gt;sourcetype=source1|lookup Lookup.csv Address as srcip&lt;/P&gt;

&lt;P&gt;For Source2&lt;/P&gt;

&lt;P&gt;sourcetype=source2|lookup Lookup.csv Address as source-address&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 10:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191464#M55122</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2015-05-20T10:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191465#M55123</link>
      <description>&lt;P&gt;If you have given name to lookup in Splunk you can use its name. in lookup command instead of using .csv&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 10:07:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191465#M55123</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2015-05-20T10:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191466#M55124</link>
      <description>&lt;P&gt;Thanks Arun, I can get the lookup working indiviually, i.e. one search per source, what I was really looking for is one search that will search and match against both sources, is this possible?&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 10:13:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191466#M55124</guid>
      <dc:creator>neilsmith2</dc:creator>
      <dc:date>2015-05-20T10:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191467#M55125</link>
      <description>&lt;P&gt;Ok why dont you rename srcip and source-address to other variable like&lt;/P&gt;

&lt;P&gt;sourcetype=source1 sourcetype=source2|eval srcIpAddress=if(isnotnull(srcip),srcip,if(isnotnull(source-address),source-address,NULL))|lookup Lookup.csv Address as srcIpAddress&lt;/P&gt;

&lt;P&gt;Or you can join it twice like below&lt;/P&gt;

&lt;P&gt;But make sure that you will take backup of Time,Attack fields before 2nd join (Because they will be replace in the second join)&lt;/P&gt;

&lt;P&gt;sourcetype=source1 sourcetype=source2|lookup Lookup.csv Address as srcip|rename Time as temp_Time,Attack as temp_Attack|lookup Lookup.csv Address as source-address|eval Attack=if(isnotnull(temp_Attack),temp_Attack,Attack)|eval Attack=if(isnotnull(temp_Time),temp_Time,Time)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:59:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191467#M55125</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2020-09-28T19:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191468#M55126</link>
      <description>&lt;P&gt;A better way to do what &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/38103"&gt;@Arun_N_007&lt;/a&gt; suggests is to use the &lt;CODE&gt;coalesce&lt;/CODE&gt; function, which will allow you to collapse two differently-named fields into one depending on their existence in one sourcetype or another:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=source1 OR sourcetype=source2
| eval Address=coalesce(srcip,source-address)
| lookup Lookup.csv Address ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191468#M55126</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2020-09-28T19:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191469#M55127</link>
      <description>&lt;P&gt;Many thanks both; those answers work nicely. Currently I'm having a play with:&lt;/P&gt;

&lt;P&gt;sourcetype="source1" OR sourcetype="source2" | eval srcIPAddress=coalesce(src_ip,source_address)| eval DestPort=coalesce(dest_port,destination_port) | lookup Lookup Address as srcIPAddress OUTPUT Address as IPMatch, Attack as Attack_name | stats count by IPMatch, Attack_name, DestPort&lt;/P&gt;

&lt;P&gt;Improvements to this most welcome (I have no programming and very little scripting experience!). &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:59:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191469#M55127</guid>
      <dc:creator>neilsmith2</dc:creator>
      <dc:date>2020-09-28T19:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191470#M55128</link>
      <description>&lt;P&gt;Please accept the answer&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 15:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191470#M55128</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2015-05-20T15:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups against multiple sources (with differing field names for the same value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191471#M55129</link>
      <description>&lt;P&gt;Please accept the Answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2015 04:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-against-multiple-sources-with-differing-field/m-p/191471#M55129</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2015-05-21T04:29:06Z</dc:date>
    </item>
  </channel>
</rss>

