<?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: Can we create lookup table for specific owner? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335773#M99720</link>
    <description>&lt;P&gt;Ya. This above method works fine for re-owner for already existing lookup file. Is there any REST API to create lookup table for specific user (login user itself)&lt;BR /&gt;
I am using this curl to create specific user lookup file. &lt;BR /&gt;
&lt;CODE&gt;curl -k -u usrname:pwd &lt;A href="https://localhost:8089/servicesNS/usrname/app_name/data/lookup-table-files" target="test_blank"&gt;https://localhost:8089/servicesNS/usrname/app_name/data/lookup-table-files&lt;/A&gt; -d 'eai:data=/opt/splunk/var/run/splunk/lookup_tmp/lookupfile.csv' -d 'name=lookupfile.csv'&lt;/CODE&gt;&lt;BR /&gt;
But, problem here is lookup file should be present at lookup stanza area (&lt;CODE&gt;/opt/splunk/var/run/splunk/lookup_tmp&lt;/CODE&gt;) with javascript can not create file at specified location.&lt;/P&gt;

&lt;P&gt;Is there a way to create lookup table for individual users?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2017 09:42:16 GMT</pubDate>
    <dc:creator>sumangala</dc:creator>
    <dc:date>2017-04-21T09:42:16Z</dc:date>
    <item>
      <title>Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335771#M99718</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Is there any way that we can create lookup table for specific user? As I checked outputlookup command and it doesn't provide any option provide owner name. Can anyone help me here. As I searched lots of documentation regarding this, but couldn't find it.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2017 13:14:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335771#M99718</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-20T13:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335772#M99719</link>
      <description>&lt;P&gt;If you are asking to be able to output a lookup and have it owned by someone other than the user you are logged in as I do not think that is possible.&lt;BR /&gt;
You &lt;EM&gt;can&lt;/EM&gt; share your lookup if you have appropriate permissions within the application or at the global level.&lt;/P&gt;

&lt;P&gt;You can also change the owner/sharing level of a lookup via the REST API, the endpoints of interest are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/servicesNS/-/-/data/lookup-table-files
/servicesNS/-/-/data/transforms/lookups
/servicesNS/-/-/data/props/lookups
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where the above REST endpoints list the the lookup files, the lookup definitions and automatic lookups in that order&lt;/P&gt;

&lt;P&gt;If you wanted to list them then you would access:&lt;BR /&gt;
&lt;A href="https://localhost:8089/servicesNS/-/-/data/lookup-table-files?count=-1"&gt;https://localhost:8089/servicesNS/-/-/data/lookup-table-files?count=-1&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://localhost:8089/servicesNS/-/-/data/props/lookups?count=-1"&gt;https://localhost:8089/servicesNS/-/-/data/props/lookups?count=-1&lt;/A&gt; &lt;BR /&gt;
&lt;A href="https://localhost:8089/servicesNS/-/-/data/transforms/lookups?count=-1"&gt;https://localhost:8089/servicesNS/-/-/data/transforms/lookups?count=-1&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Or similar.&lt;/P&gt;

&lt;P&gt;To re-own the item you can use python, curl or your preferred program, the Splunk binary can also do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$SPLUNK_HOME/bin/splunk _internal call "/servicesNS/&amp;lt;theNewOwner&amp;gt;/&amp;lt;appContext&amp;gt;/data/lookup-table-files/lookupfilename.csv/acl" -post:owner &amp;lt;newOwner&amp;gt; -post:sharing user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where sharing can be user (where user is private), app, or global (the system / shared permission in all applications).&lt;/P&gt;

&lt;P&gt;There are curl examples here:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.3/RESTTUT/RESTbasicexamples"&gt;Examples using the Splunk REST API&lt;/A&gt; in particular refer to this section that I've quoted from the document:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Share an object to an app, modify its&lt;BR /&gt;
permissions, and edit it Make Alice's&lt;BR /&gt;
saved search, mysearch, available&lt;BR /&gt;
through the app, myapp. Allow all&lt;BR /&gt;
users permissions to read the saved&lt;BR /&gt;
search.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:pass &lt;A href="https://localhost:8089/servicesNS/alice/myapp/saved/searches/mysearch/acl" target="test_blank"&gt;https://localhost:8089/servicesNS/alice/myapp/saved/searches/mysearch/acl&lt;/A&gt;  \
        -d perms.read=* \
        -d owner=alice \
        -d sharing=app
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2017 08:17:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335772#M99719</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-04-21T08:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335773#M99720</link>
      <description>&lt;P&gt;Ya. This above method works fine for re-owner for already existing lookup file. Is there any REST API to create lookup table for specific user (login user itself)&lt;BR /&gt;
I am using this curl to create specific user lookup file. &lt;BR /&gt;
&lt;CODE&gt;curl -k -u usrname:pwd &lt;A href="https://localhost:8089/servicesNS/usrname/app_name/data/lookup-table-files" target="test_blank"&gt;https://localhost:8089/servicesNS/usrname/app_name/data/lookup-table-files&lt;/A&gt; -d 'eai:data=/opt/splunk/var/run/splunk/lookup_tmp/lookupfile.csv' -d 'name=lookupfile.csv'&lt;/CODE&gt;&lt;BR /&gt;
But, problem here is lookup file should be present at lookup stanza area (&lt;CODE&gt;/opt/splunk/var/run/splunk/lookup_tmp&lt;/CODE&gt;) with javascript can not create file at specified location.&lt;/P&gt;

&lt;P&gt;Is there a way to create lookup table for individual users?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 09:42:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335773#M99720</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-21T09:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335774#M99721</link>
      <description>&lt;P&gt;Hi garethatiag,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Thank u for detailed description of answer. It really helped me to change ownership. But, my question is while creating lookup file itself, can I create for per user basis by rest api? This can be done by splunk web interface. `| makeresults | eval name="usrname" | eval token="bvsd4534vff"| outputlookup lookup_21april.csv append=True createinapp=True` This creates a lookup file in app level `$splunk_path/etc/apps/app_name/lookup`.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want it to create at &lt;CODE&gt;$splunk_path/etc/users/usr_name/app_name/lookup&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 10:01:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335774#M99721</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-21T10:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335775#M99722</link>
      <description>&lt;P&gt;Why not create the lookup in 1 curl call, then another RESTful/curl call to change the owner/sharing to user level?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 01:21:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335775#M99722</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-04-24T01:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335776#M99723</link>
      <description>&lt;P&gt;``&lt;CODE&gt;Hi garethatiag,&lt;BR /&gt;
       I did the same thing 1search command to create lookup file at app level by this:&lt;BR /&gt;
&lt;/CODE&gt;| makeresults | eval name="usrname" | eval token="bvsd4534vff"| outputlookup lookup_21april.csv append=True createinapp=True`&lt;/P&gt;

&lt;P&gt;Now,&lt;BR /&gt;
I want to change its ownership of lookup file by:&lt;BR /&gt;
Here form_uid is new user name and lookup file is ready present at app level before executing below code.&lt;BR /&gt;
I tried with both the method by XMLHttpRequest and Jquery Ajax. I am getting 404 error.&lt;BR /&gt;
Whether this resource isn't there on the web server?&lt;/P&gt;

&lt;P&gt;By XMLHttpRequest:&lt;/P&gt;

&lt;P&gt;if(window.XMLHttpRequest){&lt;BR /&gt;
 var xmlhttp = new XMLHttpRequest();&lt;BR /&gt;
 }else if(window.ActiveXObject) {&lt;BR /&gt;
 var xmlhttp = new ActiveXObject(Microsoft.XMLHTTP);&lt;BR /&gt;
 }&lt;BR /&gt;
 var record = {&lt;BR /&gt;
 "owner": form_uid,&lt;BR /&gt;
 "sharing": "user"&lt;BR /&gt;
 };&lt;BR /&gt;
 var url = '/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl';&lt;BR /&gt;
 xmlhttp.open("POST", url, true);&lt;BR /&gt;
 xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');&lt;BR /&gt;
 xmlhttp.onreadystatechange = function() {//Call a function when the state changes.&lt;BR /&gt;
 if (xmlhttp.readyState == 4 &amp;amp;&amp;amp; xmlhttp.status == 200) {&lt;BR /&gt;
 console.log(xmlhttp.responseText);&lt;BR /&gt;
 }&lt;BR /&gt;
 };&lt;BR /&gt;
 xmlhttp.send(JSON.stringify(record));&lt;/P&gt;

&lt;P&gt;By Jquery Ajax:&lt;/P&gt;

&lt;P&gt;$.ajax({&lt;BR /&gt;
 type: "POST",&lt;BR /&gt;
 url:'/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl',&lt;BR /&gt;
 dataType: 'text/csv',&lt;BR /&gt;
 data: JSON.stringify(record),&lt;BR /&gt;
 beforeSend: function (xmlhttp) {&lt;BR /&gt;
 xmlhttp.setRequestHeader('Accept-Language', 'en_US');&lt;BR /&gt;
 }&lt;BR /&gt;
 });&lt;BR /&gt;
Could please help me out to resolve whats the wrong in my above code or why resource is not &lt;BR /&gt;
available in splunk web server?```&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:47:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335776#M99723</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2020-09-29T13:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335777#M99724</link>
      <description>&lt;P&gt;So your application is called "app_name"  where the lookup is located?&lt;BR /&gt;
Can you see it in a webbrowser via:&lt;BR /&gt;
https://:8089/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv' &lt;BR /&gt;
?&lt;/P&gt;

&lt;P&gt;Or via a curl get request...&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:46:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335777#M99724</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2020-09-29T13:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335778#M99725</link>
      <description>&lt;P&gt;Hi garethatiag,&lt;BR /&gt;
Currently lookup file at app level folder as below:&lt;BR /&gt;
&lt;CODE&gt;/opt/splunk/etc/apps/splunk_app/lookups/lookup_user_name.csv&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Now I want to change to user_name level folder by executing this curl command.&lt;BR /&gt;
&lt;CODE&gt;curl -k -u user_name:password https://localhost:8089/servicesNS/user_name/splunk_app/data/lookup-table-files/lookup_user_name.csv/acl -d owner=user_name -d sharing=user&lt;/CODE&gt;&lt;BR /&gt;
then lookup file location changes to:&lt;BR /&gt;
&lt;CODE&gt;/opt/splunk/etc/users/user_name/splunk_app/lookups/lookup_padmin.csv&lt;/CODE&gt;&lt;BR /&gt;
This work correctly with curl command.&lt;/P&gt;

&lt;P&gt;Same thing I want to do with JavaScript api call.&lt;BR /&gt;
I can't execute this url without body. As body contain &lt;CODE&gt;owner=user_name -d sharing=user&lt;/CODE&gt;&lt;BR /&gt;
this is main parameter to move lookup file location.&lt;BR /&gt;
&lt;CODE&gt;https://:8089/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv'&lt;/CODE&gt;&lt;BR /&gt;
I executed this I got 'This site can’t be reached' error.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:47:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335778#M99725</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2020-09-29T13:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335779#M99726</link>
      <description>&lt;P&gt;Sorry I rarely (if ever) use javascript!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 07:35:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335779#M99726</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-04-24T07:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create lookup table for specific owner?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335780#M99727</link>
      <description>&lt;P&gt;Its Ok... Thank u... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Can any one help here. Why resource is not available in Splunk web server?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 07:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335780#M99727</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-24T07:42:52Z</dc:date>
    </item>
  </channel>
</rss>

