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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...