Splunk Cloud Platform

Facing "An established connection was aborted by your host machine" while connecting to the splunk.

venkatramana
Loves-to-Learn Lots
package org.example;



import com.splunk.HttpService;
import com.splunk.SSLSecurityProtocol;
import com.splunk.Service;
import com.splunk.ServiceArgs;

public class ActualSplunk {
public static void main(String[] args) {
// Create ServiceArgs object with connection parameters
ServiceArgs loginArgs = new ServiceArgs();
loginArgs.setUsername("providedvalidusername");
loginArgs.setPassword("providedvalidpassword");
loginArgs.setHost("hostname");
loginArgs.setPort(8089);

HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

// Connect to Splunk
Service service = Service.connect(loginArgs);

// Check if connection is successful
if (service != null) {
System.out.println("Connected to Splunk!");
// Perform operations with the 'service' object as needed
} else {
System.out.println("Failed to connect to Splunk.");
}

// Close the connection when done
if (service != null) {
service.logout(); // Logout from the service
// service.close(); // Close the service connection
}
}
}

when i run the above code to connect to the local splunk it is working fine with my local splunk credentials.
But when i tried same code in my VM with the actual splunk cloud host, username, password to connect to the splunk to get the logs it throwing an exception
"java.lang.RuntimeException:An established connection was aborted by your host machine".

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...