<?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: Python splunk submit event doesnt work correctly, event not found in splunk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423654#M7490</link>
    <description>&lt;P&gt;Thanks for your answer, the problem is in ":" colons in event, it still doesn't work with the code your provided on github. I wonder if you can try it, in my case it ignores&lt;/P&gt;

&lt;P&gt;"145.255.2.146 - - [2015-12-12*&lt;EM&gt;:22:21:00&lt;/EM&gt;* +0100] ""GET /administrator/ HTTP/1.1"" 200 4263 ""-"" ""Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0"" ""-"""&lt;/P&gt;

&lt;P&gt;PS: If I remove colons ":" it works as in using socket, and your code.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:27:10 GMT</pubDate>
    <dc:creator>kairat</dc:creator>
    <dc:date>2020-09-29T20:27:10Z</dc:date>
    <item>
      <title>Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423649#M7485</link>
      <description>&lt;P&gt;When I try to add event string like = "37.31.31.31 - - [13/Dec/2015:23:08:40 +0100] ""POST /administrator/index.php HTTP/1.1"" 200 4494 ""&lt;A href="http://almhuette-raith.at/administrator/%22"&gt;http://almhuette-raith.at/administrator/"&lt;/A&gt;" ""Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0"" ""-""" &lt;/P&gt;

&lt;P&gt;It ignores it, not throwing any errors.&lt;/P&gt;

&lt;P&gt;When I send events like "HELLO", "THIS IS TEST" it works.&lt;/P&gt;

&lt;P&gt;The code sample is here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client
service = client.connect(
                        host=HOST,
                        port=PORT,
                        username=USERNAME,
                        password=PASSWORD)

myindex = service.indexes["main"]
myindex.submit(STRING, sourcetype="access_combined.log", host="local")

Version 2
with myindex.attached_socket(sourcetype='access_combined.log') as sock:
    sock.send(str.encode(STRING))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 05:48:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423649#M7485</guid>
      <dc:creator>kairat</dc:creator>
      <dc:date>2018-07-09T05:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423650#M7486</link>
      <description>&lt;P&gt;I want to send an event using python-sdk.&lt;/P&gt;

&lt;P&gt;Event's content  "145.255.2.146 - - [2015-12-12:23:08:40  +0100] ""GET /administrator/ HTTP/1.1"" 200 4263 ""-"" ""Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0"" ""-"""&lt;/P&gt;

&lt;P&gt;If we remove colons event will be sent, please, help me.&lt;/P&gt;

&lt;P&gt;The code below doesn't show any mistake, neither add an event to splunk&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client

service = client.connect(
                        host=HOST,
                        port=PORT,
                        username=USERNAME,
                        password=PASSWORD)
myindex = service.indexes["main"]
mysocket = myindex.attach(sourcetype='access_combined.log',host='local')
mysocket.send(str.encode('"145.255.2.146 - - [2015-12-12 +0100] ""GET /administrator/ HTTP/1.1"" 200 4263 ""-"" ""Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0"" ""-"""'))
mysocket.close()
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jul 2018 03:58:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423650#M7486</guid>
      <dc:creator>kairat</dc:creator>
      <dc:date>2018-07-10T03:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423651#M7487</link>
      <description>&lt;P&gt;Hello @kairat&lt;BR /&gt;
,&lt;BR /&gt;
did you try to escape the colons? I mean did you try to replace &lt;CODE&gt;"&lt;/CODE&gt; with &lt;CODE&gt;\"&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 06:11:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423651#M7487</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-07-10T06:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423652#M7488</link>
      <description>&lt;P&gt;It's OK with double quotes, the problem is about &lt;STRONG&gt;:&lt;/STRONG&gt; When I removed colons(:), as in the comment provided with code, it works. I don't know why it's so. &lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 04:26:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423652#M7488</guid>
      <dc:creator>kairat</dc:creator>
      <dc:date>2018-07-11T04:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423653#M7489</link>
      <description>&lt;P&gt;You are also better off sending data via HEC rather than directly via the API like this. Since you are in python already you can use a HEC class like  &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>Thu, 12 Jul 2018 15:44:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423653#M7489</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2018-07-12T15:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423654#M7490</link>
      <description>&lt;P&gt;Thanks for your answer, the problem is in ":" colons in event, it still doesn't work with the code your provided on github. I wonder if you can try it, in my case it ignores&lt;/P&gt;

&lt;P&gt;"145.255.2.146 - - [2015-12-12*&lt;EM&gt;:22:21:00&lt;/EM&gt;* +0100] ""GET /administrator/ HTTP/1.1"" 200 4263 ""-"" ""Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0"" ""-"""&lt;/P&gt;

&lt;P&gt;PS: If I remove colons ":" it works as in using socket, and your code.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:27:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423654#M7490</guid>
      <dc:creator>kairat</dc:creator>
      <dc:date>2020-09-29T20:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Python splunk submit event doesnt work correctly, event not found in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423655#M7491</link>
      <description>&lt;P&gt;Hello @kairat,&lt;BR /&gt;
I am confused. In the head of the post,  you stated that with that code, you could not get the event added to Splunk, and now you say it works. &lt;BR /&gt;
Anyway, the colons you removed changed the format of the date of the event, and the result format seems quite strange.&lt;BR /&gt;
Can you please share the way you extract the date/time info for the sourcetype?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 06:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-splunk-submit-event-doesnt-work-correctly-event-not-found/m-p/423655#M7491</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-07-17T06:50:45Z</dc:date>
    </item>
  </channel>
</rss>

