<?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: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345138#M102275</link>
    <description>&lt;P&gt;This is the final query that we used&lt;/P&gt;

&lt;P&gt;|inputlookup temp.csv | stats count BY host | eval tablename=host.".csv" | map maxsearches=10000 search="|inputlookup temp.csv | search host=$host$ | outputlookup $tablename$" &lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2017 07:00:12 GMT</pubDate>
    <dc:creator>bkumarm</dc:creator>
    <dc:date>2017-03-13T07:00:12Z</dc:date>
    <item>
      <title>how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345131#M102268</link>
      <description>&lt;P&gt;we have a lookup table which is like:&lt;BR /&gt;
table:&lt;BR /&gt;
host,userid,index,status&lt;BR /&gt;
host1.dom.com,user1,idx1,Y&lt;BR /&gt;
host1.dom.com,user2,idx2,Y&lt;BR /&gt;
host2.dom.com,user1,idx1,Y&lt;BR /&gt;
host2.dom.com,user2,idx2,Y&lt;BR /&gt;
host3.dom.com,user1,idx1,Y&lt;BR /&gt;
host3.dom.com,user2,idx1,Y&lt;/P&gt;

&lt;P&gt;WE need to break this table into multiple tables based on the hostname as key. &lt;BR /&gt;
we need to execute this as dynamic search or saved search without using hardcoded values.&lt;/P&gt;

&lt;P&gt;and we need the table name to include the hostname. the expected output is :&lt;/P&gt;

&lt;P&gt;host1_table:&lt;BR /&gt;
host,userid,index,status&lt;BR /&gt;
host1.dom.com,user1,idx1,Y&lt;BR /&gt;
host1.dom.com,user2,idx2,Y&lt;/P&gt;

&lt;P&gt;host2_table:&lt;BR /&gt;
host,userid,index,status&lt;BR /&gt;
host2.dom.com,user1,idx1,Y&lt;BR /&gt;
host2.dom.com,user2,idx2,Y&lt;/P&gt;

&lt;P&gt;host3_table:&lt;BR /&gt;
host,userid,index,status&lt;BR /&gt;
host3.dom.com,user1,idx1,Y&lt;BR /&gt;
host3.dom.com,user2,idx1,Y&lt;/P&gt;

&lt;P&gt;we need help in getting this done. &lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 14:06:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345131#M102268</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-03-10T14:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345132#M102269</link>
      <description>&lt;P&gt;Hi bkumarm,&lt;BR /&gt;
it's possible to perform lookup separation in multiple searches, running as many searches as hosts (three in the following example):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search host=host1.dom.com | table field1 field2 field3 ... | outputlookup host1_table
your_search host=host2.dom.com | table field1 field2 field3 ... | outputlookup host2_table
your_search host=host3.dom.com | table field1 field2 field3 ... | outputlookup host3_table
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 14:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345132#M102269</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-03-10T14:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345133#M102270</link>
      <description>&lt;P&gt;Something like this should work the first time, with either the inputcsv/outputcsv or inputlookup/outputlookup verbs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup mybigtable | dedup host | table host | rename host as myhost | eventstats count as nbrHosts 
| map search="| inputlookup mybigtable | search host=$myhost$ | outputlookup $myhost$_table" maxsearches=nbrHosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd suggest, organizationally, that you want to keep the data in the big table as the system of record and then recreate the little tables every time the big one changes.&lt;/P&gt;

&lt;P&gt;Test the code once, change the file by adding one record or deleting one, and test it again to make sure the output verb is having the desired effect.  &lt;/P&gt;

&lt;P&gt;It's going to need a little more tweaking to kill the ".com" off the end of the hostname.  You also need to clarify, in the case of "host1.dom.com", whether you want the table name to be host1_table or host1.dom_table or host1_dom_table.  if you choose the first, then you stand a chance of ending up with duplicate files overwriting each other; subdomains of two different organizations-- for example, mainhost.domain1.com and mainhost.domain2.com -- would land on the same mainhost_table output file.)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345133#M102270</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-09-29T13:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345134#M102271</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup MyCombinedLookup
| stats count BY host
| rex field=host "(?&amp;lt;tablename&amp;gt;[^\.]*)"
| eval tablename = tablename . "_table"
| map maxsearches=10000 search="|inputlookup MyCombinedLookup | search host=$host$ | outputlookup $tablename$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Mar 2017 22:58:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345134#M102271</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-10T22:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345135#M102272</link>
      <description>&lt;P&gt;Thanks DalJeanis . actually I need the table names to be unique identifiers mapping to hostname and hostname.csv is the best choice. &lt;BR /&gt;
as you had suggested the search query worked after a lil tweak. &lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 06:30:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345135#M102272</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-03-13T06:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345136#M102273</link>
      <description>&lt;P&gt;Thanks Woodcock. that was a straight answer to my question. It worked.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 06:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345136#M102273</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-03-13T06:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345137#M102274</link>
      <description>&lt;P&gt;A refined search query as below is what we used finally ..&lt;/P&gt;

&lt;P&gt;|inputlookup temp.csv | stats count BY host | eval tablename=host.".csv" | map maxsearches=10000 search="|inputlookup temp.csv | search host=$host$ | outputlookup $tablename$" &lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 06:59:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345137#M102274</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-03-13T06:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to break a lookup table into mulitple lookup tables ( rowwise or based on a field value)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345138#M102275</link>
      <description>&lt;P&gt;This is the final query that we used&lt;/P&gt;

&lt;P&gt;|inputlookup temp.csv | stats count BY host | eval tablename=host.".csv" | map maxsearches=10000 search="|inputlookup temp.csv | search host=$host$ | outputlookup $tablename$" &lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 07:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-break-a-lookup-table-into-mulitple-lookup-tables-rowwise/m-p/345138#M102275</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-03-13T07:00:12Z</dc:date>
    </item>
  </channel>
</rss>

