Developing for Splunk Enterprise

Why are events sent directly to index over socket using python SDK not seen in event search?

New Member

There is no error shown while sending data over socket using Python SDK. But the event is not available in search. Why?
import splunklib;
import config;
import splunklib.client as client
import socket

# Create a Service instance and log in
service = client.connect(

# Get the collection of indexes
indexes = service.indexes

# List the indexes and their event counts
for index in indexes:
    #count = index["totalEventCount"]
    print ((

# 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'
# Close the socket
Tags (1)
0 Karma

New Member

also service.indexes is not listing all the indexes I have access to.

0 Karma
Take the 2021 Splunk Career Survey

Help us learn about how Splunk has
impacted your career by taking the 2021 Splunk Career Survey.

Earn $50 in Amazon cash!