Hi Experts,
I am new to Splunk so please bear with me if this is stupid.
I have been doing some tinkering with the Splunk SDK for Java. While I have been successfully able to connect and retrieve data to locally installed Splunk Enterprise in my Windows machine. When I try to do the same for my remote Indexer(Linux box) from my Windows machine, the program fails to connect. The code snippet is as below :
HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1);
ServiceArgs connectionArgs = new ServiceArgs();
connectionArgs.setHost("hostname.domainname");
connectionArgs.setUsername("admin");
connectionArgs.setPassword("password");
connectionArgs.setPort(8089);
connectionArgs.setScheme("https");
When I run the above code from Eclipse in Windows, I get the below error :
java.lang.RuntimeException: Connection timed out: connect
at com.splunk.HttpService.send(HttpService.java:409)
at com.splunk.Service.send(Service.java:1293)
at com.splunk.HttpService.post(HttpService.java:308)
at com.splunk.Service.login(Service.java:1122)
at com.splunk.Service.login(Service.java:1101)
at com.splunk.Service.connect(Service.java:187)
at com.splunk.examples.spurl.Program.run(Program.java:40)
at com.splunk.examples.spurl.Program.main(Program.java:30)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
Please let me know if this can be fixed, or this is the wrong way to do it. 😞
I have tried with SSLv3,TLSv1.1,TLSv1.2 but nothing works...
Have you tried using curl to see if you can successfully hit the endpoint? Is the indexer behind a proxy? Is the REST API enabled?
This page has some things to try: http://dev.splunk.com/view/csharp-sdk-pcl/SP-CAAAE7W
Thanks for the information.
Actually yes the Indexer is behind a proxy. Also the REST API is enabled.
OK, I would try curl to see if you can successfully make a request and access the API.