<?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 Comparing values between two different fields in ad-hoc search and inputlookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385564#M112594</link>
    <description>&lt;P&gt;Hello Splunkers,&lt;/P&gt;

&lt;P&gt;I am attempting to match values (IP addresses) between FieldA in a search, and FieldB in an inputlookup. I want to come out with a table of only values in FieldB that are also in FieldA. Some pseudocode to explain my logic:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;myList = []
for value in FieldB:
     if value in FieldA:
          myList.append(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have attempted to use &lt;EM&gt;appendcols&lt;/EM&gt;, &lt;EM&gt;append&lt;/EM&gt;, &lt;EM&gt;if(like(..))&lt;/EM&gt;, &lt;EM&gt;(if(match(..))&lt;/EM&gt;, and simply &lt;EM&gt;search [|inputlookup ...] | where fieldA=fieldB&lt;/EM&gt; without any luck. Comparing the fields directly with &lt;EM&gt;where fieldB=fieldA&lt;/EM&gt; also does not provide any successful results. I am unable to simply compare in a list of values as strings, as there are potentially hundreds of thousands of distinct values.&lt;/P&gt;

&lt;P&gt;It is also noticeable that the name of fieldB (dest_ip) actually does exist in the ad-hoc search result set, but I am not at all concerned with those values, only those in the inputlookup.&lt;/P&gt;

&lt;P&gt;Any help to a Splunk newbie is much appreciated, thank you!&lt;/P&gt;

&lt;P&gt;edit - I did find partial success combining values(fieldA) and values(fieldB) in mv-fields and then expanding and checking against the values in the other. I got true positive results, but both data sets are so large that it far exceeds my memory limits for just a 60 minute window - let alone 1-3 months that I need.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jun 2018 23:12:13 GMT</pubDate>
    <dc:creator>alexbradley</dc:creator>
    <dc:date>2018-06-15T23:12:13Z</dc:date>
    <item>
      <title>Comparing values between two different fields in ad-hoc search and inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385564#M112594</link>
      <description>&lt;P&gt;Hello Splunkers,&lt;/P&gt;

&lt;P&gt;I am attempting to match values (IP addresses) between FieldA in a search, and FieldB in an inputlookup. I want to come out with a table of only values in FieldB that are also in FieldA. Some pseudocode to explain my logic:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;myList = []
for value in FieldB:
     if value in FieldA:
          myList.append(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have attempted to use &lt;EM&gt;appendcols&lt;/EM&gt;, &lt;EM&gt;append&lt;/EM&gt;, &lt;EM&gt;if(like(..))&lt;/EM&gt;, &lt;EM&gt;(if(match(..))&lt;/EM&gt;, and simply &lt;EM&gt;search [|inputlookup ...] | where fieldA=fieldB&lt;/EM&gt; without any luck. Comparing the fields directly with &lt;EM&gt;where fieldB=fieldA&lt;/EM&gt; also does not provide any successful results. I am unable to simply compare in a list of values as strings, as there are potentially hundreds of thousands of distinct values.&lt;/P&gt;

&lt;P&gt;It is also noticeable that the name of fieldB (dest_ip) actually does exist in the ad-hoc search result set, but I am not at all concerned with those values, only those in the inputlookup.&lt;/P&gt;

&lt;P&gt;Any help to a Splunk newbie is much appreciated, thank you!&lt;/P&gt;

&lt;P&gt;edit - I did find partial success combining values(fieldA) and values(fieldB) in mv-fields and then expanding and checking against the values in the other. I got true positive results, but both data sets are so large that it far exceeds my memory limits for just a 60 minute window - let alone 1-3 months that I need.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 23:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385564#M112594</guid>
      <dc:creator>alexbradley</dc:creator>
      <dc:date>2018-06-15T23:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing values between two different fields in ad-hoc search and inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385565#M112595</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;index=foo [| inputlookup myList.csv | format]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jun 2018 01:22:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385565#M112595</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-06-16T01:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing values between two different fields in ad-hoc search and inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385566#M112596</link>
      <description>&lt;P&gt;Hi alexbradley,&lt;BR /&gt;
you have to use a subsearch using attention that the field name used in main search and subsearch is the same, so in your example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index [ | inputlookup my_lookup.csv | rename fieldB AS fieldA | fields fieldA ]
| table _time fieldA 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jun 2018 08:00:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385566#M112596</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-06-16T08:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing values between two different fields in ad-hoc search and inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385567#M112597</link>
      <description>&lt;P&gt;Thanks for your input Giuseppe; unless I grossly misunderstand, however, this doesn't find matching values between the two fields - rather gives me listings of events with fields FieldA and _time without regard to matching between the ad-hoc search and the inputlookup.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jun 2018 18:50:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385567#M112597</guid>
      <dc:creator>alexbradley</dc:creator>
      <dc:date>2018-06-16T18:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing values between two different fields in ad-hoc search and inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385568#M112598</link>
      <description>&lt;P&gt;Have you tried the search?  Your comment implies you have not.&lt;/P&gt;

&lt;P&gt;Subsearches are like parentheses in math - they come first.  The &lt;CODE&gt;|inputlookup...&lt;/CODE&gt; subsearch expands into a list of fieldA values that, when combined with &lt;CODE&gt;index=my_index&lt;/CODE&gt; creates a search through my_index for all fieldA values present in the lookup table.  That's sounds like what you're looking for.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2018 16:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385568#M112598</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-06-17T16:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing values between two different fields in ad-hoc search and inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385569#M112599</link>
      <description>&lt;P&gt;Now with less weekend-brain: I do see what you're getting at and will run this at the first opportunity. Thanks for the clarification, richgalloway.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 21:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-values-between-two-different-fields-in-ad-hoc-search/m-p/385569#M112599</guid>
      <dc:creator>alexbradley</dc:creator>
      <dc:date>2018-06-20T21:32:20Z</dc:date>
    </item>
  </channel>
</rss>

