Comments (9)
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.
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.
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.
@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.
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.
@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.
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.
@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.
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)
- ResultsReaderCsv.java throws ArrayIndexOutOfBoundsException HOT 6
- Is this abandoned?? HOT 1
- Connection Reset after some requests to splunk api HOT 3
- latest SDK failed with JDK 1.6 and JDK 1.7 , Connection reset error HOT 2
- getting java.io.IOException: Premature EOF while fetching data from splunk HOT 3
- Attributes from Splunk ES Correlation Search Entry HOT 5
- Need a way to turn on TLS hostname verification HOT 2
- JFrog Repo Not Accessible HOT 1
- how to add custom header if we use AWS API Gateway X-API-Key validation HOT 12
- maven-deploy-plugin is included as a transitive dependency in 1.7.1 HOT 2
- Splunk Java SDk not supporting sslCertPath while writing to outputs.conf HOT 12
- SSL Certificates in truststores HOT 3
- Modular Input: Error during ValidationDefinition/InputDefinition when no value for parameter is passed HOT 11
- SSL ValidateCertificates Still Attempts to Validate When Set to False HOT 4
- The SSL verification fails even when setValidateCertificates was set to `false` HOT 3
- SSL Certificates issue: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException HOT 2
- Aggregate field values are cut off when it presents dollar symbols ($) HOT 1
- create search job returns HTTP 400 response with message: "Please specify timerange to search data"
- Service.connect method is not compatible for token based authentication
- Modular input Introspection failing only on Windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from splunk-sdk-java.