<?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 How to add a new row to a lookup using a Splunk query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429061#M122712</link>
    <description>&lt;P&gt;Is there a Splunk query to add a new row or a new column to a lookup table?&lt;/P&gt;

&lt;P&gt;I specifically ask for a query because I want my Python script to append rows automatically.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2019 08:45:16 GMT</pubDate>
    <dc:creator>agentsofshield</dc:creator>
    <dc:date>2019-03-12T08:45:16Z</dc:date>
    <item>
      <title>How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429061#M122712</link>
      <description>&lt;P&gt;Is there a Splunk query to add a new row or a new column to a lookup table?&lt;/P&gt;

&lt;P&gt;I specifically ask for a query because I want my Python script to append rows automatically.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 08:45:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429061#M122712</guid>
      <dc:creator>agentsofshield</dc:creator>
      <dc:date>2019-03-12T08:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429062#M122713</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Check this link&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Outputlookup"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Outputlookup&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 08:49:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429062#M122713</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-12T08:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429063#M122714</link>
      <description>&lt;P&gt;Didn't help, can I get the specific example?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 09:01:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429063#M122714</guid>
      <dc:creator>agentsofshield</dc:creator>
      <dc:date>2019-03-12T09:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429064#M122715</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Please try below query (In below query assume that I have single column in CSV with header IP).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBaseSearch&amp;gt;
| eval ip="1.2.3.4"
| fields ip
| outputlookup append=t &amp;lt;existing_lookup.csv&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup &amp;lt;existing_lookup.csv&amp;gt;
| append [ makeresults | eval ip="1.2.3.4"]
| fields ip
| outputlookup &amp;lt;existing_lookup.csv&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: Updated query so only &lt;CODE&gt;ip&lt;/CODE&gt; field will be added/updated in CSV lookup.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 09:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429064#M122715</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-12T09:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429065#M122716</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try with outputlookup command&lt;/P&gt;

&lt;P&gt;ex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults |eval id=3,name="test3" | outputlookup append=true samplelookup
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2019 09:38:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429065#M122716</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-12T09:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429066#M122717</link>
      <description>&lt;P&gt;One approach, which I find most robust is:&lt;/P&gt;

&lt;P&gt;1.) Open your original lookup.&lt;BR /&gt;
2.) Table your new row&lt;BR /&gt;
3.) Dedup (if necessary)&lt;BR /&gt;
4.) Write the updated lookup&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [your search which produces results of 1 or more rows]
| inputlookup append=true mylookup.csv
|table field_id, field_a, field_b
|dedup field_id
|outputlookup mylookup.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using this method you can add both rows and columns if needed by including them in the table command. This will load the 'old copy' of the file, and re-write the file with all the rows/columns present in the table. &lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 09:39:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429066#M122717</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-12T09:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429067#M122718</link>
      <description>&lt;P&gt;How do I "make results"?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 12:30:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429067#M122718</guid>
      <dc:creator>agentsofshield</dc:creator>
      <dc:date>2019-03-12T12:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429068#M122719</link>
      <description>&lt;P&gt;But I'm not taking my new values from a Splunk search. It's from a Python script. How do I just put specific values in the lookup?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 12:31:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429068#M122719</guid>
      <dc:creator>agentsofshield</dc:creator>
      <dc:date>2019-03-12T12:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429069#M122720</link>
      <description>&lt;P&gt;As you are using python so first create splunk query using python, if you want to add more results then you can do something like this while creating query.&lt;/P&gt;

&lt;P&gt;Create variable called &lt;CODE&gt;ip&lt;/CODE&gt; and with all values delimited with semicolon so something like this &lt;CODE&gt;ip="3.4.5.6;10.10.0.1"&lt;/CODE&gt; and then use below splunk query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup &amp;lt;existing_lookup.csv&amp;gt;
| append [ makeresults | eval ip="3.4.5.6;10.10.0.1" ]
| table ip
| eval ip=split(ip,";")
| mvexpand ip
| dedup ip
| outputlookup &amp;lt;existing_lookup.csv&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then fire above query in splunk using python script.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 12:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429069#M122720</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-12T12:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new row to a lookup using a Splunk query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429070#M122721</link>
      <description>&lt;P&gt;A python script running outside of splunk?&lt;BR /&gt;
If so, you just need to configure the script to write a new line (and optionally a header if you're adding new cols) to the csv in the lookups directory, but you will want to include error handling etc to make sure you don't trash the original file.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 13:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-new-row-to-a-lookup-using-a-Splunk-query/m-p/429070#M122721</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-12T13:17:54Z</dc:date>
    </item>
  </channel>
</rss>

