Getting Data In

Unable to Connect to Linux Splunk Indexer from Windows using SDK Java

Subhra
Explorer

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...

Tags (4)

gblock_splunk
Splunk Employee
Splunk Employee

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

Subhra
Explorer

Thanks for the information.

Actually yes the Indexer is behind a proxy. Also the REST API is enabled.

0 Karma

gblock_splunk
Splunk Employee
Splunk Employee

OK, I would try curl to see if you can successfully make a request and access the API.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...