Splunk Dev

Moving from splunk2.jar to new jar file splunk-1.0.jar

kalyani1184
New Member

Right now when we are using the splunk2.jar and we are using the code

SplunkClient client = new SplunkClient(url.trim()+":"+port.trim());
client.login(username, password);
SearchManager smgr = client.getSearchManager();

JobParameters jobParameters = new JobParameters(); jobParameters.Search = prequery + query.trim(); jobParameters.setEarliestTime(startDate);
jobParameters.setLatestTime(endDate);

SearchJob job = smgr.dispatchAndWait(jobParameters);
CookedParameters cp = new CookedParameters(); List fields = new ArrayList(); fields.add("_raw"); fields.add("host"); fields.add("sourcetype"); fields.add("source"); cp.FieldList = fields; cp.Count = 2500;

JsonArray jsa = job.getCookedResultsJSON(cp);

But now we wanted to upgrade to splunk-1.0.jar file. None of this code is compatable with the splunk-1.0 jar. How will the code change with respect to the new jar file?

0 Karma

Neeraj_Luthra
Splunk Employee
Splunk Employee

The splunk2.jar on code.google.com is legacy code and no longer available and/or supported. The SDKs available on Developer Platform are the ones that are officially kept up to date with the latest Splunk versions.

Unfortunately there is no documented migration path but we have very rich documentation on the the Splunk SDK for Java. How-To section has sample code for running searches and displaying results. You can use that as a reference and update your code accordingly.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...