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 + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

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

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...