Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Splunk Java SDK Example - Connect and Login to Splunk
/**
* Connect and Login to Splunk
*
* @return Service instance
*/
public static Service connectAndLoginToSplunkExample() {
ServiceArgs connectionArgs = new ServiceArgs();
connectionArgs.setHost("ubuntu-splunk");
connectionArgs.setUsername("admin");
connectionArgs.setPassword("splunk");
connectionArgs.setPort(8089);
// will login and save the session key which gets put in the HTTP Authorization header
Service splunkService = Service.connect(connectionArgs);
System.out.println("Auth Token : " + splunkService.getToken());
return splunkService;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.