I have a working task to create Java-integration with Splunk system that is used by one of our clients. So I installed Splunk trial version on my virtual machine and trying to connect to it with Java and make some test search requests.
I have the following exception:
> com.splunk.HttpException: HTTP 401 -- Remote login disabled because you are> using a free license which does not provide authentication. To resolve> either switch to the forwarder-only license or the enterprise trial> license included with the product. To override this and enable> unauthenticated remote management, edit the 'allowRemoteLogin' setting in> your server.conf file.
At first glance there are some explanations but I don't understand what should be done exactly so that I can emulate connection to real client's Splunk properly.
I am absolutely new with Splunk. It is my fist efforts.
My code is the following:
public void connectToSplunk(){
HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);
ServiceArgs loginArgs = new ServiceArgs();
loginArgs.setUsername("admin");
loginArgs.setPassword("my_password");
loginArgs.setHost("my_host");
loginArgs.setPort(8089);
loginArgs.setScheme("https");
Service splunkService = Service.connect(loginArgs);
System.out.println("Splunk service created.");
Job job = splunkService.getJobs().create("search host=testcsv"); //at this point I have an Exception
...
}
↧