<?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: Comparing input lookup table to index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636422#M221029</link>
    <description>&lt;P&gt;OK, so it's all about your field names.&lt;/P&gt;&lt;P&gt;In your original search you said AccountId=Title, which is looking for a text value of Title in AccountId field, whereas here you are setting BindleName field to the same value as the Title&amp;nbsp;&lt;STRONG&gt;field&lt;/STRONG&gt;, which where the confusion comes in.&lt;/P&gt;&lt;P&gt;But in your example here you are saying you want to find&amp;nbsp;&lt;STRONG&gt;both&lt;/STRONG&gt; the Business field AND the BindleName field from the lookup.&lt;/P&gt;&lt;P&gt;Given your description you would probably want something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=csmp
| rex field=Title "^CSMP\s-\s(?&amp;lt;BindleName&amp;gt;\w+)\s-\s([a-zA-Z0-9 ]*)$"
| lookup CostCentersandAWSAccounts.csv BindleName OUTPUT Business&lt;/LI-CODE&gt;&lt;P&gt;which is saying&amp;nbsp;&lt;/P&gt;&lt;P&gt;a) Extract a field called BindleName from the Title field&lt;BR /&gt;b) Lookup the BindleName field against the same named column in the lookup and OUTPUT the Business field from the lookup&lt;/P&gt;&lt;P&gt;Note - when posting searches, use the code block &amp;lt;/&amp;gt; to format the SPL for easy reading, as above&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 22:29:41 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-03-28T22:29:41Z</dc:date>
    <item>
      <title>Comparing input lookup table to index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636243#M220957</link>
      <description>&lt;P&gt;Hello -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking to match an uploaded lookup table in csv format to the indexes we have. I am running into problems since the column I want to match in the index is not parsed. I have two questions:&lt;/P&gt;
&lt;P&gt;1. Can we parse in splunk to extract the numbers and words we need? If so, what is the resource I need or how do I parse correctly?&lt;/P&gt;
&lt;P&gt;2. I am looking to match a column in my lookup table to the parsed data in the index. We have different indexes and we need to look all of them up with the same lookup table csv. What I have so far is this, do we need eval command?&lt;/P&gt;
&lt;P&gt;index=guardduty | [ |inputlookup CostCentersandAWSAccounts.csv | search AccountId=Title | fields Business ]&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 14:14:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636243#M220957</guid>
      <dc:creator>hantun</dc:creator>
      <dc:date>2023-03-28T14:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing input lookup table to index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636245#M220958</link>
      <description>&lt;P&gt;Yes, you can parse/extract in Splunk&lt;/P&gt;&lt;P&gt;rex is your friend&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/Rex" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So, it looks like you are trying to look for any rows in your lookup where AccountId has the value "Title" and then pass the Business field from the lookup as a constraint to the index=guardduty. You don't need the first | (pipe) symbol before the subsearch BTW.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=guardduty | [ |inputlookup CostCentersandAWSAccounts.csv | search AccountId=Title | fields Business ]&lt;/LI-CODE&gt;&lt;P&gt;so, if the guardduty data does not have a field called Business, but has something, e.g. BusinessName, then you will have to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=guardduty [ 
  | inputlookup CostCentersandAWSAccounts.csv where AccountId=Title 
  | fields Business 
  | rename Business as BusinessName ]&lt;/LI-CODE&gt;&lt;P&gt;Note the use of 'where AccountId=Title' which pre-filters rather than post-search.&lt;/P&gt;&lt;P&gt;If you mean that there is no Business field yet extracted that you want to match against the Business field in the lookup, then you have to do either a or b&lt;/P&gt;&lt;P&gt;a. Create a new field extraction or a calculated field that creates a Business field for all indexes you want to match and then you can search like above.&lt;/P&gt;&lt;P&gt;b. Do a rex extraction and then do a lookup against the lookup file, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=guardduty 
| rex "(?&amp;lt;Business&amp;gt;....regex_to_extract_business...)"
| eval AccountId="Title"
| lookup CostCentersandAWSAccounts.csv AccountId Business&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Mar 2023 04:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636245#M220958</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-03-28T04:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing input lookup table to index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636387#M221013</link>
      <description>&lt;P&gt;I got up to this:&lt;/P&gt;&lt;P&gt;index=csmp&lt;/P&gt;&lt;P&gt;| rex field=Title "^CSMP\s-\s(?&amp;lt;BindleName&amp;gt;\w+)\s-\s([a-zA-Z0-9 ]*)$"&lt;/P&gt;&lt;P&gt;| eval BindleName=Title&lt;/P&gt;&lt;P&gt;| lookup CostCentersandAWSAccounts.csv Business BindleName&lt;/P&gt;&lt;P&gt;I am confused why it is not returning the BindleName which is what I am parsing and comparing to the Lookup table's column named BindleName. Once the comparison is made, I want the search to return the related row of the Business column from the Lookup table. I feel like I am missing something big here...&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:38:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636387#M221013</guid>
      <dc:creator>hantun</dc:creator>
      <dc:date>2023-03-28T19:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing input lookup table to index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636422#M221029</link>
      <description>&lt;P&gt;OK, so it's all about your field names.&lt;/P&gt;&lt;P&gt;In your original search you said AccountId=Title, which is looking for a text value of Title in AccountId field, whereas here you are setting BindleName field to the same value as the Title&amp;nbsp;&lt;STRONG&gt;field&lt;/STRONG&gt;, which where the confusion comes in.&lt;/P&gt;&lt;P&gt;But in your example here you are saying you want to find&amp;nbsp;&lt;STRONG&gt;both&lt;/STRONG&gt; the Business field AND the BindleName field from the lookup.&lt;/P&gt;&lt;P&gt;Given your description you would probably want something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=csmp
| rex field=Title "^CSMP\s-\s(?&amp;lt;BindleName&amp;gt;\w+)\s-\s([a-zA-Z0-9 ]*)$"
| lookup CostCentersandAWSAccounts.csv BindleName OUTPUT Business&lt;/LI-CODE&gt;&lt;P&gt;which is saying&amp;nbsp;&lt;/P&gt;&lt;P&gt;a) Extract a field called BindleName from the Title field&lt;BR /&gt;b) Lookup the BindleName field against the same named column in the lookup and OUTPUT the Business field from the lookup&lt;/P&gt;&lt;P&gt;Note - when posting searches, use the code block &amp;lt;/&amp;gt; to format the SPL for easy reading, as above&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 22:29:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-input-lookup-table-to-index/m-p/636422#M221029</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-03-28T22:29:41Z</dc:date>
    </item>
  </channel>
</rss>

