<?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: How to upload a .csv file onto a Splunk remote server using Python? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453157#M99418</link>
    <description>&lt;P&gt;If you mean csv lookup ,csv lookups are not part of the REST API. You'd need to use KVStore. if this is data why does it need to be csv? JSON with HEC is substantially simpler. If it absolutely must be csv data vs a lookup you can always use RAW mode with HEC.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2019 13:16:53 GMT</pubDate>
    <dc:creator>starcher</dc:creator>
    <dc:date>2019-08-19T13:16:53Z</dc:date>
    <item>
      <title>How to upload a .csv file onto a Splunk remote server using Python?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453156#M99417</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am trying to upload a .csv file onto a remote Splunk server through the use of a Python script and I am having a bit of difficulty in getting this to run. The methods I have tried are: &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Method 1:&lt;/STRONG&gt; Creating a service and then connecting to the server &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; """Connect to splunk local"""

     import splunklib.client as client
     import splunklib.results as results
     from splunklib.binding import AuthenticationError

     HOST=hostname
     PORT = '8089'
     USERNAME = 'username'
     PASSWORD = 'password'
     try:
         service = client.connect(host=HOST, port=PORT, username=USERNAME, password=PASSWORD)
     except exception as e:
         print(str(e))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The issue with this was that it never seemed to connect. Please note that the host was not a local host but rather a remote Splunk server. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Method 2:&lt;/STRONG&gt; Using the HTTP Event Collector&lt;/P&gt;

&lt;P&gt;Whilst the HTTP event collector worked well in sending the data through line by line, however, the data needs to be in csv format, not JSON, which it is converted to.&lt;/P&gt;

&lt;P&gt;Any thoughts and suggestions on how to proceed would be much helpful! Would prefer to be python based solution rather than setting up a file monitor on Splunk&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 04:06:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453156#M99417</guid>
      <dc:creator>vkannampuzha</dc:creator>
      <dc:date>2019-08-19T04:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a .csv file onto a Splunk remote server using Python?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453157#M99418</link>
      <description>&lt;P&gt;If you mean csv lookup ,csv lookups are not part of the REST API. You'd need to use KVStore. if this is data why does it need to be csv? JSON with HEC is substantially simpler. If it absolutely must be csv data vs a lookup you can always use RAW mode with HEC.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 13:16:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453157#M99418</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2019-08-19T13:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a .csv file onto a Splunk remote server using Python?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453158#M99419</link>
      <description>&lt;P&gt;&lt;A href="https://github.com/georgestarcher/Splunk-Class-httpevent"&gt;https://github.com/georgestarcher/Splunk-Class-httpevent&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 13:20:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453158#M99419</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2019-08-19T13:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a .csv file onto a Splunk remote server using Python?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453159#M99420</link>
      <description>&lt;P&gt;I do agree with JSON being much simpler with HEC, however, the data is being used for pre-existing models that require the format to be csv. I just tried the RAW mode and that seems to be much better. Is there any way for Splunk to recognise fields then with this method? &lt;/P&gt;

&lt;P&gt;Thanks very much for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 02:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453159#M99420</guid>
      <dc:creator>vkannampuzha</dc:creator>
      <dc:date>2019-08-20T02:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload a .csv file onto a Splunk remote server using Python?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453160#M99421</link>
      <description>&lt;P&gt;Read the docs on getting data into Splunk.  Setup your sourcetype. setup it's parsing etc.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/Data/Getstartedwithgettingdatain"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/Data/Getstartedwithgettingdatain&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 13:04:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-upload-a-csv-file-onto-a-Splunk-remote-server-using/m-p/453160#M99421</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2019-08-20T13:04:47Z</dc:date>
    </item>
  </channel>
</rss>

