<?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: Filter out a subset of items based on another value in a CSV lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328247#M97712</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I believe the easiest way is the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;% your query %
| lookup lookup_filename.csv node_code AS testnode 
| search region_code=$token_drilldown$
| fields - region_code
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Of course, you must change &lt;CODE&gt;lookup_filename.csv&lt;/CODE&gt; and &lt;CODE&gt;$token_drilldown$&lt;/CODE&gt; with the names of your lookup and drilldown token.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Apr 2018 05:08:59 GMT</pubDate>
    <dc:creator>nryabykh</dc:creator>
    <dc:date>2018-04-12T05:08:59Z</dc:date>
    <item>
      <title>Filter out a subset of items based on another value in a CSV lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328246#M97711</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;

&lt;P&gt;So lets say I have a CSV file that looks like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;node_code   region_code
SAN          AMERICAS
JPN          APAC
NYC          AMERICAS
CHN          APAC
FRA          EMEA
NUR          EMEA
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And lets say my search is the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;errorcode=$errorcode_tok$ | dedup em_event_alert | eval dv_node=upper(dv_node) | rex field=dv_node "(?P&amp;amp;lt;testnode&amp;amp;gt;\w{3})" | stats count by testnode&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And just for reference:&lt;/P&gt;

&lt;P&gt;Field Definitions&lt;BR /&gt;
- dv_node = The string that holds the hostname of devices&lt;BR /&gt;
- em_event_alert = A unique alert ID #&lt;/P&gt;

&lt;P&gt;What I'm trying to do is create a dropdown with a list of Regions. So in this example, if the user selects AMERICAS from the dropdown, I want to filter the search results to only display those corresponding items... in our case, SAN &amp;amp; NYC would be the values displayed.&lt;/P&gt;

&lt;P&gt;As you can see in the search, it queries for the selected errorcode (don't worry, I already have that functionality figured out), dedup's, and then it takes the hostname, and makes the whole thing uppercase. Finally, we strip out just the first 3 letters (that's how I am able to match it up to the node_code field in the CSV). But I can't seem to determine how to start to create that search query. Any ideas would definitely be appreciated. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328246#M97711</guid>
      <dc:creator>kiddsupreme</dc:creator>
      <dc:date>2020-09-29T18:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Filter out a subset of items based on another value in a CSV lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328247#M97712</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;

&lt;P&gt;I believe the easiest way is the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;% your query %
| lookup lookup_filename.csv node_code AS testnode 
| search region_code=$token_drilldown$
| fields - region_code
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Of course, you must change &lt;CODE&gt;lookup_filename.csv&lt;/CODE&gt; and &lt;CODE&gt;$token_drilldown$&lt;/CODE&gt; with the names of your lookup and drilldown token.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 05:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328247#M97712</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-04-12T05:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Filter out a subset of items based on another value in a CSV lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328248#M97713</link>
      <description>&lt;P&gt;Not sure I follow in regards to the $token_drilldown$ variable. I've never used drilldown because as far as I know, its based on you clicking on something to go down further. I just want to utilize a dropdown menu with those values. &lt;/P&gt;

&lt;P&gt;If you can go into more detail, maybe it would make sense; right now, I'm not seeing it.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 18:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328248#M97713</guid>
      <dc:creator>kiddsupreme</dc:creator>
      <dc:date>2018-04-12T18:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filter out a subset of items based on another value in a CSV lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328249#M97714</link>
      <description>&lt;P&gt;I'm sorry for typo, I meant &lt;CODE&gt;$token_dropdown$&lt;/CODE&gt; (not &lt;CODE&gt;$token_drilldown$&lt;/CODE&gt;) as token from your dropdown list.&lt;/P&gt;

&lt;P&gt;With the &lt;CODE&gt;lookup&lt;/CODE&gt; command you'll create a new field &lt;CODE&gt;region_code&lt;/CODE&gt; corresponding to &lt;CODE&gt;testnode&lt;/CODE&gt;. And with &lt;CODE&gt;search&lt;/CODE&gt; command you'll filter out all region codes except selected in dropdown list.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 06:05:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-out-a-subset-of-items-based-on-another-value-in-a-CSV/m-p/328249#M97714</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-04-13T06:05:00Z</dc:date>
    </item>
  </channel>
</rss>

