<?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: Connecting to local Splunk instance from an app? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380987#M6324</link>
    <description>&lt;P&gt;The App is a custom developed app that defines a modular input (json from an API call). It would be nice - at least during development - to give the app the possibility to check on data that was already stored in splunk earlier by that same app. Currently, this is done using username and password but a more elegant way such as using a token, maybe specific to that case would be nice.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Aug 2018 13:02:02 GMT</pubDate>
    <dc:creator>guldendraak</dc:creator>
    <dc:date>2018-08-03T13:02:02Z</dc:date>
    <item>
      <title>Connecting to local Splunk instance from an app?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380985#M6322</link>
      <description>&lt;P&gt;When using the Splunk Python SDK, connecting to a Splunk instance is very easy as is described here: &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE4"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEE4&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This typically uses the Splunk server address, port username and password. Is there a better way to establish a connection to the local Splunk instance from an app? The doc mentions cookies but I am unsure how to use them.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 14:29:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380985#M6322</guid>
      <dc:creator>guldendraak</dc:creator>
      <dc:date>2018-07-31T14:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to local Splunk instance from an app?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380986#M6323</link>
      <description>&lt;P&gt;Do you want to connect a Splunk App which back to the Splunk Instance, or do you have a 'standalone' app which should connect to Splunk?&lt;BR /&gt;
Splunk knows a sessionid which has a limited lifespan and can be used to authenticate a connections.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 12:43:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380986#M6323</guid>
      <dc:creator>FritzWittwer_ol</dc:creator>
      <dc:date>2018-08-03T12:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to local Splunk instance from an app?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380987#M6324</link>
      <description>&lt;P&gt;The App is a custom developed app that defines a modular input (json from an API call). It would be nice - at least during development - to give the app the possibility to check on data that was already stored in splunk earlier by that same app. Currently, this is done using username and password but a more elegant way such as using a token, maybe specific to that case would be nice.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 13:02:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380987#M6324</guid>
      <dc:creator>guldendraak</dc:creator>
      <dc:date>2018-08-03T13:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to local Splunk instance from an app?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380988#M6325</link>
      <description>&lt;P&gt;Yes, on a single instance of Splunk, this is easy. In a distributed install, not so much. There is, as far as I am aware, no way to get an authentication token that will authorize you to a whole Splunk cluster, so you must authenticate individually to each node. On the instance you're running your modular input on however, this is supported.&lt;/P&gt;

&lt;P&gt;If you look at the XML passed back to your modular input, there is a session token present. I'm not all that familiar with the python SDK, but it looks like maybe it's the &lt;CODE&gt;get_scheme()&lt;/CODE&gt; method on &lt;CODE&gt;splunklib.modularinput.Script&lt;/CODE&gt;. See:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.2/AdvancedDev/ModInputsScripts#Define_a_scheme_for_introspection"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.2/AdvancedDev/ModInputsScripts#Define_a_scheme_for_introspection&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/PythonSDK"&gt;http://docs.splunk.com/Documentation/PythonSDK&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The token you receive from the modular input is passed to connect as the &lt;CODE&gt;token&lt;/CODE&gt; parameter.&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE4"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEE4&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 15:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380988#M6325</guid>
      <dc:creator>coccyx</dc:creator>
      <dc:date>2018-08-03T15:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to local Splunk instance from an app?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380989#M6326</link>
      <description>&lt;P&gt;That proved to be the right hint. When sub-classing &lt;A href="http://docs.splunk.com/DocumentationStatic/PythonSDK/1.6.5/modularinput.html#splunklib.modularinput.Script"&gt;splunklib.modularinput.script&lt;/A&gt; as is described &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAER3"&gt;here&lt;/A&gt;, one can simply use &lt;CODE&gt;self.service&lt;/CODE&gt; for example: &lt;CODE&gt;job = self.service.jobs.create(search)&lt;/CODE&gt; where &lt;CODE&gt;search&lt;/CODE&gt; is an actual Splunk search.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 12:10:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Connecting-to-local-Splunk-instance-from-an-app/m-p/380989#M6326</guid>
      <dc:creator>guldendraak</dc:creator>
      <dc:date>2019-03-21T12:10:59Z</dc:date>
    </item>
  </channel>
</rss>

