If you set a namespace in your session, you can't Index.submit.
I have a test framework which allows for test cases to submit data to Splunk, then ensure it's parsed correctly - but they share the same session.
// Create session
ServiceArgs loginArgs = new ServiceArgs();
loginArgs.setApp("testapp");
... set user/pass ...
service = Service.connect(loginArgs);
// Retrieve the index for the data
Index myIndex = service.getIndexes().get( "main" );
// Specify values to apply to the event
Args eventArgs = new Args();
eventArgs.put("sourcetype", sourcetype);
eventArgs.put("host", "local");
// Submit an event over HTTP
myIndex.submit(eventArgs, data);
Error
com.splunk.HttpException: HTTP 404 -- Not Found
at com.splunk.HttpException.create(HttpException.java:84)
at com.splunk.HttpService.send(HttpService.java:452)
at com.splunk.Service.send(Service.java:1293)
at com.splunk.Receiver.submit(Receiver.java:169)
at com.splunk.Index.submit(Index.java:1097)
Easy workaround is to have a seperate session for reading / writing. Maybe this is by design?
If you set a namespace in your session, you can't Index.submit.
I have a test framework which allows for test cases to submit data to Splunk, then ensure it's parsed correctly - but they share the same session.
Error
Easy workaround is to have a seperate session for reading / writing. Maybe this is by design?