Security

Can you directly publish data from your Java application to Splunk Web?

MarcHelou
New Member

Hello there,
I want to try and catch the spl query submitted on the web interface in my java application, process this query and get the data it wants, and them publish this data from my java application to the web interface.
All this should happen in the background so the user can't know that my script got his query and that my script will return his search. is it possible?
and one more question, I have splunk on docker and I downloaded the java sdk,
if i execute this command :
curl -u admin:xxxx -k https://localhost:8089/services/auth/login -d username=admin -d password=xxxx
i get a session token reply.
if I try to connect from the java application I get an handshake_failure
Thanks in advance,
I hope someone can help me.
PS:

this is the java code

package hellosplunk;

import com.splunk.Service;
import com.splunk.ServiceArgs;

public class helloSplunk {

public static void main(String[] args) {
    // TODO Auto-generated method stub
     ServiceArgs loginArgs = new ServiceArgs();
     loginArgs.setUsername("admin");
     loginArgs.setPassword("xxxx");
     loginArgs.setHost("localhost");
     loginArgs.setPort(8089);
     loginArgs.setScheme("https");

     Service splunkService = Service.connect(loginArgs);

     System.out.println(splunkService.getToken());


}

}

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

This is a perfect use case for the Splunk HTTP Event collector and/or Splunk logging for Java.

0 Karma

woodcock
Esteemed Legend
0 Karma

MarcHelou
New Member

Thanks for the reply,
that is not exactly what i am searching for unless I didnt understand the documentation.
in other word what i want is that everytime an spl query is made, it triggers my java application, and sends the query to my java app, this app performs the query and with the returned results, my java app posts them [the results] back to the splunk web interface.

so let's say:
1- you searched : index=_audit
2- the query goes to the java app
3- the java contact the splunkd
4- splunkd returns results to the java
5- the java posts the result back to the web interface

I want to know if that is possible or not
Thanks

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...