You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use the submit operation given by the sdk as in the following example.
I have tried to find documentation on how to handle different responses from splunk for the submit action but I cant find any, how can I validate if the submit operation was successful or if it failed?
importsplunklib.clientasclientimportjson# Connect to Splunkservice=client.connect(
host="your_splunk_host",
port=8089,
username="your_username",
password="your_password"
)
# Prepare your JSON datajson_data= {
"event": {
"name": "John Doe",
"age": 30,
"city": "New York"
},
"sourcetype": "my_json_data",
"index": "main"
}
# Convert JSON to stringevent_data=json.dumps(json_data)
# Send data to Splunk using HECindex=service.indexes["main"]
index.submit(event_data, sourcetype="my_json_data")
print("JSON data uploaded successfully")
The text was updated successfully, but these errors were encountered:
Hey,
I want to use the submit operation given by the sdk as in the following example.
I have tried to find documentation on how to handle different responses from splunk for the submit action but I cant find any, how can I validate if the submit operation was successful or if it failed?
The text was updated successfully, but these errors were encountered: