<?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: Use Python to upload file into Splunk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317033#M4368</link>
    <description>&lt;P&gt;Why bother with any code at all?  Splunk already has a CLI for this called &lt;CODE&gt;add oneshot&lt;/CODE&gt;:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorfilesanddirectoriesusingtheCLI"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorfilesanddirectoriesusingtheCLI&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Sep 2017 15:17:25 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-09-04T15:17:25Z</dc:date>
    <item>
      <title>Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317031#M4366</link>
      <description>&lt;P&gt;I follow the instructions in here &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE6"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEE6&lt;/A&gt; and just want to upload 1 single file into Splunk using Python with codes like this:&lt;/P&gt;

&lt;P&gt;myindex = service.indexes["test_index"]&lt;BR /&gt;
uploadme = "test.csv"&lt;BR /&gt;
myindex.upload(uploadme);&lt;/P&gt;

&lt;P&gt;I simply put the test.csv file together with the source code. However, it always show the error:&lt;BR /&gt;
splunklib.binding.HTTPError: HTTP 400 Bad Request -- unable to open file: path='test.csv' error='The system cannot find the file specified.'&lt;/P&gt;

&lt;P&gt;I've also tried to specify the whole path like this but also gives the same error:&lt;BR /&gt;
uploadme = "c:/test/test.csv"&lt;/P&gt;

&lt;P&gt;How should I specify the filename (in Windows)? Or where should I put the file?&lt;/P&gt;

&lt;P&gt;P.S. I've already built the Splunk connection in Python and can run search properly.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2017 09:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317031#M4366</guid>
      <dc:creator>ericchaucl</dc:creator>
      <dc:date>2017-09-04T09:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317032#M4367</link>
      <description>&lt;P&gt;Are you trying to upload the file to a remote server? If so, the default service configuration for Splunk is such that it cannot reference files that are not stored locally. In such a case the file path you are specifying must be local to the server itself. &lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2017 13:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317032#M4367</guid>
      <dc:creator>mumblingsages</dc:creator>
      <dc:date>2017-09-04T13:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317033#M4368</link>
      <description>&lt;P&gt;Why bother with any code at all?  Splunk already has a CLI for this called &lt;CODE&gt;add oneshot&lt;/CODE&gt;:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorfilesanddirectoriesusingtheCLI"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorfilesanddirectoriesusingtheCLI&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2017 15:17:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317033#M4368</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-09-04T15:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317034#M4369</link>
      <description>&lt;P&gt;Thanks! If the default service Splunk configuration cannot reference files that are not stored locally, can I update the configuration to allow this?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 02:27:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317034#M4369</guid>
      <dc:creator>ericchaucl</dc:creator>
      <dc:date>2017-09-05T02:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317035#M4370</link>
      <description>&lt;P&gt;I'm writing a Python program to analyze some external raw data and want to export the results into Splunk for further handling/reporting. Would be perfect if I can control the whole workflow in Python directly. &lt;/P&gt;

&lt;P&gt;Thanks for the advise and may have a try on that.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 02:36:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317035#M4370</guid>
      <dc:creator>ericchaucl</dc:creator>
      <dc:date>2017-09-05T02:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317036#M4371</link>
      <description>&lt;P&gt;I believe there is but I haven't had time to fully investigate that as part of my development. Instead, I've created network share on the remote host that my python script has access too (and nothing else) and it copies it's to there. Then in my upload call via python I specify the local path (not the share name) on the remote host. &lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 15:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317036#M4371</guid>
      <dc:creator>mumblingsages</dc:creator>
      <dc:date>2017-09-05T15:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317037#M4372</link>
      <description>&lt;P&gt;Good idea and it works. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 01:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317037#M4372</guid>
      <dc:creator>ericchaucl</dc:creator>
      <dc:date>2017-09-06T01:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317038#M4373</link>
      <description>&lt;P&gt;Did this work for you ?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 03:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317038#M4373</guid>
      <dc:creator>tolaram</dc:creator>
      <dc:date>2019-04-02T03:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317039#M4374</link>
      <description>&lt;P&gt;Busy in working on something else and have put down this issue for a long time .....&lt;/P&gt;

&lt;P&gt;This approach could work for my case to build a prototype only.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 06:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317039#M4374</guid>
      <dc:creator>ericchaucl</dc:creator>
      <dc:date>2019-04-02T06:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python to upload file into Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317040#M4375</link>
      <description>&lt;P&gt;Busy in working on something else and have put down this issue for a long time .....&lt;/P&gt;

&lt;P&gt;This approach could work for my case to build a prototype only.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 06:44:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Use-Python-to-upload-file-into-Splunk/m-p/317040#M4375</guid>
      <dc:creator>ericchaucl</dc:creator>
      <dc:date>2019-04-02T06:44:48Z</dc:date>
    </item>
  </channel>
</rss>

