<?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 Why are events sent directly to index over socket using python SDK not seen in event search? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Why-are-events-sent-directly-to-index-over-socket-using-python/m-p/457823#M8325</link>
    <description>&lt;P&gt;There is no error shown while sending data over socket using Python SDK. But the event is not available in search. Why?&lt;BR /&gt;
    import splunklib;&lt;BR /&gt;
    import config;&lt;BR /&gt;
    import splunklib.client as client&lt;BR /&gt;
    import socket&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Create a Service instance and log in
service = client.connect(
    host=config.splunkconfig.get("host"),
    port=config.splunkconfig.get("port"),
    username=config.splunkconfig.get("user"),
    password=config.splunkconfig.get("password"))

# Get the collection of indexes
indexes = service.indexes

# List the indexes and their event counts
for index in indexes:
    #count = index["totalEventCount"]
    print ((index.name))

# Retrieve the index for the data
myindex = service.indexes["main"]

# Open a socket
mysocket = myindex.attach(sourcetype="splunk_input_test")

# Send events to it
data=b'This is my splunk test event\r\n'
mysocket.sendall(data)
# Close the socket
mysocket.close()
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Nov 2018 20:23:03 GMT</pubDate>
    <dc:creator>shobhas</dc:creator>
    <dc:date>2018-11-02T20:23:03Z</dc:date>
    <item>
      <title>Why are events sent directly to index over socket using python SDK not seen in event search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-are-events-sent-directly-to-index-over-socket-using-python/m-p/457823#M8325</link>
      <description>&lt;P&gt;There is no error shown while sending data over socket using Python SDK. But the event is not available in search. Why?&lt;BR /&gt;
    import splunklib;&lt;BR /&gt;
    import config;&lt;BR /&gt;
    import splunklib.client as client&lt;BR /&gt;
    import socket&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Create a Service instance and log in
service = client.connect(
    host=config.splunkconfig.get("host"),
    port=config.splunkconfig.get("port"),
    username=config.splunkconfig.get("user"),
    password=config.splunkconfig.get("password"))

# Get the collection of indexes
indexes = service.indexes

# List the indexes and their event counts
for index in indexes:
    #count = index["totalEventCount"]
    print ((index.name))

# Retrieve the index for the data
myindex = service.indexes["main"]

# Open a socket
mysocket = myindex.attach(sourcetype="splunk_input_test")

# Send events to it
data=b'This is my splunk test event\r\n'
mysocket.sendall(data)
# Close the socket
mysocket.close()
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Nov 2018 20:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-are-events-sent-directly-to-index-over-socket-using-python/m-p/457823#M8325</guid>
      <dc:creator>shobhas</dc:creator>
      <dc:date>2018-11-02T20:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why are events sent directly to index over socket using python SDK not seen in event search?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-are-events-sent-directly-to-index-over-socket-using-python/m-p/457824#M8326</link>
      <description>&lt;P&gt;also service.indexes is not listing all the indexes I have access to.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 21:00:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-are-events-sent-directly-to-index-over-socket-using-python/m-p/457824#M8326</guid>
      <dc:creator>shobhas</dc:creator>
      <dc:date>2018-11-02T21:00:42Z</dc:date>
    </item>
  </channel>
</rss>

