Not sure why it doesn't work. I use python to upload data from a file to an index on my local Splunk. This is what I did
1. I installed splunk-sdk for python. Installed simply using the pip install command so:
pip install splunk-sdk
2. On python, you need to first connect to your local Splunk server
"""Connect to splunk local"""
import splunklib.client as client
import splunklib.results as results
from splunklib.binding import AuthenticationError
HOST=localhost
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))
3. Upload your file to your index
myindex = service.indexes[ENTER INDEX NAME] # Retrieve the index for the data
try:
myindex.upload(ENTER THE ABSOLUTE PATH TO YOUR FILE) # Upload file
to the index specified
except Exception as e:
print(str(e))
... View more