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".
... View more