GithubHelp home page GithubHelp logo

Comments (9)

Ikenahim avatar Ikenahim commented on August 11, 2024

This where I use Service to create query:

    Job job = session.make_Request().getJobs().create(Query);

    while(!job.isDone())
    {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    JobResultsArgs resultsArgs = new JobResultsArgs();
    resultsArgs.setOutputMode(JobResultsArgs.OutputMode.JSON);
    InputStream results = job.getResults(resultsArgs);
    try
    {
        ResultsReaderJson resultsReader = new ResultsReaderJson(results);
        return  resultsReader; // to be tested
    } catch (IOException e)
    {
        e.printStackTrace();
    }
    return null;
}

from splunk-sdk-java.

shakeelmohamed avatar shakeelmohamed commented on August 11, 2024

What port value are you using?

Is there any reason you can't use the Service(Map<String, Object> args) constructor, or Service.login() as I've shown below?

    Service service = new Service(host,port);
++  service.login(user_name, pasword);
--  String credential = user_name+":"+pasword;
--  String basicAuthHeader  = Base64.getEncoder().encodeToString(credential.getBytes());

--  service.setToken("Basic"+basicAuthHeader);

    if(service.getToken()!= null)
    {
        this.token = service.getToken();
        Authenticated();
    }

    return  service;

from splunk-sdk-java.

Ikenahim avatar Ikenahim commented on August 11, 2024

I use 443 as Splunk is hosted in host with https protocol.
and for host I use Ip address of the host
I used that method since I want to see one session to request query to Splunk without the need to log for each time I want to perform a query

from splunk-sdk-java.

shakeelmohamed avatar shakeelmohamed commented on August 11, 2024

@Ikenahim The REST API uses port 8089 for Splunk Enterprise, are you using Splunk Cloud? If so, what's the host value?

The Java SDK has support for cookie-based authentication so you can login once per Service instance and you'll continue to get new tokens behind the scenes if you continue making requests.

from splunk-sdk-java.

Ikenahim avatar Ikenahim commented on August 11, 2024

what is the best approach to login? is it good idea to login for each request ?
I'm using Splunk enterprise.

from splunk-sdk-java.

shakeelmohamed avatar shakeelmohamed commented on August 11, 2024

@Ikenahim can you show how you're using the SDK exactly? Once you login with a Service object you shouldn't need to login again for each request

from splunk-sdk-java.

Ikenahim avatar Ikenahim commented on August 11, 2024

I have fixed that, it was an issue with firewall rules.
I have another problem right with URI cant be null! I have searched this they suggest to add
HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

before making the request which I did but still same problem? how to fix this knowing that I'm using Java sdk 11

Thank you

from splunk-sdk-java.

shakeelmohamed avatar shakeelmohamed commented on August 11, 2024

@Ikenahim can you share your anonymized code that uses the SDK? If you don't want to share it publicly, please email us at [email protected]

We are unable to help you until we know exactly what you're trying to accomplish.

from splunk-sdk-java.

Ikenahim avatar Ikenahim commented on August 11, 2024

This was fixed, was an issue with SSL certificate, a team from security department has fixed this issue . Thank you

from splunk-sdk-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.