<?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 Can you create/modify a lookup file via REST API? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193671#M55785</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Is it possible to create/modify a lookup file via Splunk's REST API? I don't see anything that addresses this functionality (which, in my mind, is a big hole).&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2020 04:16:22 GMT</pubDate>
    <dc:creator>a212830</dc:creator>
    <dc:date>2020-12-02T04:16:22Z</dc:date>
    <item>
      <title>Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193671#M55785</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Is it possible to create/modify a lookup file via Splunk's REST API? I don't see anything that addresses this functionality (which, in my mind, is a big hole).&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 04:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193671#M55785</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2020-12-02T04:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193672#M55786</link>
      <description>&lt;P&gt;If the lookup file is "staged" on the Splunk instance (ie: you might have SCP'd it up) , you can then use :&lt;/P&gt;

&lt;P&gt;Create&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/RESTAPI/RESTknowledge#POST_data.2Flookup-table-files"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.3/RESTAPI/RESTknowledge#POST_data.2Flookup-table-files&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Modify&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/RESTAPI/RESTknowledge#POST_data.2Flookup-table-files.2F.7Bname.7D"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.3/RESTAPI/RESTknowledge#POST_data.2Flookup-table-files.2F.7Bname.7D&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But you can't remotely upload a new lookup file with these REST endpoints , you'd need to create a Custom REST Endpoint to do this.&lt;/P&gt;

&lt;P&gt;This app might interest you : &lt;A href="https://apps.splunk.com/app/1724/" target="test_blank"&gt;https://apps.splunk.com/app/1724/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Aug 2014 04:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193672#M55786</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2014-08-25T04:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193673#M55787</link>
      <description>&lt;P&gt;For current versions of Splunk I would recommend using KV store based lookups which can easily be maintained via the REST API.&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZG"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZG&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And it has the benefit that if you are using Search Head Clustering the KV Store itself handles the replication of the changes for all nodes.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 19:51:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193673#M55787</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2016-03-10T19:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193674#M55788</link>
      <description>&lt;P&gt;Thanks.   I could do all of this outside Splunk, but I'm looking for something within Splunk (module, or even better, an SPL command) that would let users do it.   &lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2016 10:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193674#M55788</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2016-03-14T10:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193675#M55789</link>
      <description>&lt;P&gt;That kinda implies doing stuff like: &lt;A href="https://splunkbase.splunk.com/app/1724"&gt;https://splunkbase.splunk.com/app/1724&lt;/A&gt; (which Damien mentioned)&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 20:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193675#M55789</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2016-03-17T20:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193676#M55790</link>
      <description>&lt;P&gt;Try this..&lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/Community:40GUIDevelopment"&gt;http://wiki.splunk.com/Community:40GUIDevelopment&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 10:14:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193676#M55790</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2016-03-18T10:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193677#M55791</link>
      <description>&lt;P&gt;Thanks, not really what I'm looking for though.   Was hoping for something similar to dbquery, where I can create the actual lookup as part of my command, and update it that way as well.  Don't want to use a gui to create the lookup (or than the actual spl command), don't want to create it/update it via curl at the OS layer.  Want it all to work similar to dbquery, only using REST...&lt;/P&gt;

&lt;P&gt;Doesn't sound like it's available (though, I will look at the utility listed below...)&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 12:11:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193677#M55791</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2016-03-18T12:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193678#M55792</link>
      <description>&lt;P&gt;Careful, that page seems applicable for Splunk 4 and, since it's a wiki, the details may no longer be applicable for current releases. Also, remember that some of those notes expose changing underlying splunk code that might be overwritten during an upgrade (so save your work!).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 14:47:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193678#M55792</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2016-03-21T14:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193679#M55793</link>
      <description>&lt;P&gt;An easy button it is you want (said like Yoda). &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Yea, looks like nothing currently available. Welcome to create it and post your first app! hint hint. lol&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 14:48:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193679#M55793</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2016-03-21T14:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193680#M55794</link>
      <description>&lt;P&gt;Can anyone explain why 2 years later there STILL isn't a better answer to this question?  I shouldn't have to write a custom endpoint to do something as simple as upload a CSV file.  If I have to push it to a staging area first, that's fine.  Where's the REST endpoint for that?  The UI has supported remote uploads ever since the lookups feature was first introduced.  What's the deal?   If this feature is being intentionally excluded can someone please explain why?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:56:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193680#M55794</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2017-02-09T21:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193681#M55795</link>
      <description>&lt;P&gt;Hey @lowell, do you recall if ever a feature request was made for this? It might have not been addressed simply because of other items with higher customer demand taking the dev resources. If you have a feature request I can make sure a corresponding engineering request is in place thereby tracking this AND validating the customer demand.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 13:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193681#M55795</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-02-10T13:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193682#M55796</link>
      <description>&lt;P&gt;I do not have an official feature request in at this time.  I was just surprised to see a few similar questions posted here, but no real movement in a few years.  The additional complexity I haven't noted yet is that I need a solution that works with Search Head Clustering.  I need to be able to consistently programmatically deploy a lookup file to all the members of the cluster. Ideally, I'd be able to not only push a new lookup, but cleanly replace an existing one.&lt;/P&gt;

&lt;P&gt;I'll work with my client to get an enhancement request created.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193682#M55796</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2017-02-10T15:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193683#M55797</link>
      <description>&lt;P&gt;Yeah without ERs just because it's in Answers doesn't mean it will work its way up the priority chain.&lt;BR /&gt;
The best solution to do it programmatically is use KVStore lookups which can be handled via rest API. &lt;/P&gt;

&lt;P&gt;You can see it mentioned in conf 2016 talk:&lt;BR /&gt;
&lt;A href="https://conf.splunk.com/sessions/2016-sessions.html#"&gt;https://conf.splunk.com/sessions/2016-sessions.html#&lt;/A&gt;&lt;BR /&gt;
Shop Smart at the KV Store: Best Value Tricks from the Splunk KV Store and REST API&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193683#M55797</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2017-02-10T15:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193684#M55798</link>
      <description>&lt;P&gt;Understood.  My primary use case is just updating simple (typically 100 lines or less, often less than 1 KB) lookup tables.  And mostly I'm looking to do this in just TAs where I want to be able to dictate the exact content of the entire table, maintain them through version control, and so on.   I agree that there are lots of other places where KVstore is the ideal solution.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:37:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193684#M55798</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2017-02-10T15:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193685#M55799</link>
      <description>&lt;P&gt;@SloshBurch,  Just sent in an enhancement request as case 448563.  Anything you can do to promote would be greatly appreciated.  Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 20:16:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193685#M55799</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2017-02-10T20:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193686#M55800</link>
      <description>&lt;P&gt;Thanks! Found it. Following and making sure a JIRA gets requested.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 13:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193686#M55800</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-02-13T13:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193687#M55801</link>
      <description>&lt;P&gt;Sanity Check: Are we all on the same page that lookups stay in sync in a SHC when used with generated with &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Outputlookup"&gt;outputlookup&lt;/A&gt;, but not &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Outputcsv"&gt;outputcsv&lt;/A&gt;. Right? Are we saying that when using the upload they do NOT stay in sync?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 22:16:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193687#M55801</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-02-13T22:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193688#M55802</link>
      <description>&lt;P&gt;I've only been looking at &lt;CODE&gt;outputlooup&lt;/CODE&gt; because (1) I need an actual lookup, not just stored search results, and (2) The docs say that &lt;CODE&gt;outputcsv&lt;/CODE&gt; isn't supported on an SHC (not surprising)&lt;/P&gt;

&lt;P&gt;I'm not aware of any issues with uploaded lookup tables. My complaint is that you can't upload it via splunkd (REST) directly, you have to do it via the UI.  Which is less ideal from a programatic perspective.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 18:04:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193688#M55802</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2017-02-14T18:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193689#M55803</link>
      <description>&lt;P&gt;You can use the stats command to create fields without event data.   Building on that, you can pack structured data into a single field and then leverage split, mvexpand, etc to unpack the data into rows and columns and output results to lookup.   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count as field1 
| eval field1="host1,54426859;host2,37203728;host3,96588101" 
| eval field1=split(field1,";") 
| mvexpand field1 
| rex field=field1 "(?&amp;lt;host&amp;gt;.*),(?&amp;lt;serial&amp;gt;.*)" 
| table host serial | outputlookup hostserials.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See below for a Powershell code snippet which transforms CSV into lookup table generating SPL, which is then passed to a function which implements the standard REST endpoint for searching.  (https://${server}:${port}/services/search/jobs/export")&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    $server = "your-server-here"
    $port = "8089"
    $username = "admin"

    $sourcefile = "C:\Development\SplunkCSVtoLookupOverREST\hostserials.csv"
    $content = Import-Csv $sourcefile

    $flattext = Out-Null
    foreach ($item in $content) {
        $thisEntry = "$($item.host),$($item.serial)"
        if ($flattext -eq $null) { $flattext = $thisEntry } else { $flattext += ";$($thisEntry)" }    
    }

    if (!($cred)) { $cred = Get-Credential -Message "enter splunk cred" -UserName $username }

    $thesearch = " | stats count as field1 
    | eval field1=`"${flattext}`"
    | eval field1=split(field1,`";`") 
    | mvexpand field1 
    | rex field=field1 `"(?&amp;lt;host&amp;gt;.*),(?&amp;lt;serial&amp;gt;.*)`" 
    | table host serial | outputlookup hostserials.csv"

    write-host $thesearch
    get-search-results -cred $cred -server $server -port $port -search $thesearch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This technique was successful in creating a 100,000 record lookup table.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 01:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193689#M55803</guid>
      <dc:creator>dstaulcu</dc:creator>
      <dc:date>2017-06-01T01:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can you create/modify a lookup file via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193690#M55804</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;
Can we push lookup table data from outside database(mongoDb lookukp collection) to splunk with splunk python sdk?&lt;/P&gt;

&lt;P&gt;We have been pushing normal data to splunk with the help of  third party JDBC unity drivers but now planning to push it with python splunk sdk. This case is possible and we know how to do it. &lt;/P&gt;

&lt;P&gt;Problem is how can we push lookup data to splunk lookup tables instead of indexes.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 21:23:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-create-modify-a-lookup-file-via-REST-API/m-p/193690#M55804</guid>
      <dc:creator>harry2007gsp</dc:creator>
      <dc:date>2018-08-01T21:23:00Z</dc:date>
    </item>
  </channel>
</rss>

