- Added static method addClusterMasterURIsToHosts in HttpService class to update list of Valid Hosts with Cluster Master Hosts (GitHub PR #215)
- Added instance method getClusterMasters in Service class to get list of cluster master hosts
- Added check for localhost IPv6 address, for IPv6 compatible apps (GitHub PR #210)
- Updating SSL_SOCKET_FACTORY instance on changing validateCertificates flag. (GitHub PR #206)
- Re-fetch logic for instancetype and version fields if not set within Service instance to avoid NPE (GitHub PR #202)
- Check for local IP as alternative to localhost within HostnameVerifier, addressing issue with certain local workflows
- Added feature that allows to update ACL properties of an entity (GitHub PR #196)
- Added null check for child to handle error when no value is passed for a parameter in modular-inputs (Ref issue #198 & GitHub PR #199)
- SDK Support for third-party (Load Balancer) "sticky sessions"(cookie persistence) (Github PR #192)
- Added Args option for Saved Search history method (GitHub Issue #126 & PR #188 )
- Special handling related to the semantic versioning of specific Search APIs functional in Splunk Enterprise 9.0.2 and (Splunk Cloud 9.0.2209). These SDK changes will enable seamless transition between the APIs based on the version of the Splunk Enterprise/Cloud (Github PR #193)
- Updated checks to fetch Storage Passwords with wildcards in namespace. (GitHub PR #187)
- SDK Support for splunkd search API changes, for Splunk 9.0+. (Github PR #189)
- Automated docs generation using GitHub actions. (Github PR #184)
- Added a support to add custom headers in Service class. (Github PR #176).
- SSL Certificate validation (default implementation) added. (Github PR #175).
- Boolean flag is introduced to skip/validate certificate. Use HttpService.setValidateCertificates() to enable/disable certificate validation.
- Breaking change: Certificate validation is now enforced by default, for local or non-production use cases use HttpService.setValidateCertificates(false).
- Apps/app-install replaced with apps/local. (Github PR #168)
- Breaking change: HttpService.useTLS flag removed, please use HttpService.setSslSecurityProtocol() to set a specific SSL/TLS implementation or else TLS v1.2 is used by default for Java 1.8.
- External Entities restricted in XML factory. (Github PR #180).
- Prevent expansion of external entities in Document Builder factory.
- Headers modified in Socket creation. (Github PR #179).
- Http Request uses raw request headers by including escape characters which seems vulnerable. It was replaced with PrintWriter methods to avoid escape characters.
- Host parameter used in Socket is omitted to prevent exposing it to external users.
- README.md file modified with all login methods along with Splunk Search creation example. (Github PR #177).
- Deploy plugin is removed from Splunk module pom to avoid redundancy. (Github PR #172).
- Setter methods for Session and Bearer token added along with test case. (Github PR #171)
- Use: service.setSplunkToken() for session tokens and service.setBearerToken() for long-lived tokens.
- Modular input folder name renamed based on newer splunk folder name validation. (Github PR #168)
- SDK app collection URL has been updated to v1.1.0 in docker compose file. (Github PR #168)
- Test files in sdk app collections are modified based on python v3 syntax.
- Added Saved Search test case based on title. (Github PR #166)
- Dependency breaking changes are resolved.
- Added Credits.md file along with licences. (Github PR #162).
- Improved TLS implementation as default behavior and turned on hostname verification for all hosts. (Github PR #158).
- Replaced Travis CI with Github actions (Github PR #161).
- Fixed Javadoc generation while project packaging. (Github PR #159).
- Fixed breaking change of Index.getMaxHotBuckets() method behavior to return as String instead of int.
- SDK build is migrated from ant build tool to maven build tool (Github PR #157).
- Dependencies directory for ant build is removed and maven dependencies are added using pom.xml.
- Dependencies are upgraded to its LTS version.
- Project structure is re-organized with respect to Maven.
- Fixed bug for push back buffer is full when exporting data in XML (GitHub PR #125).
- Fixed bug in modinput Windows shims that caused Splunk Enterprise to fail to restart (GitHub PR #120).
- Fixed bug with data model endpoint on Splunk Enterprise 7+ (GitHub PR #117).
- Fixed bug with invalid
Index.submit()
forming an invalid REST API path for namespaced services (#118). - Fixed bug with
Value.toDate(string value)
not being thread safe (GitHub PR #109).
- Added the
updated
property on allResource
objects (GitHub PR #104).
- Update modular input shims to ensure Java processes are killed (GitHub issue #92).
- Fix authentication issues when the Splunk
Set-Cookie
header is not the first one.
- Added support for retrieving
Password
entities scoped by realm and username. - Added getter methods for embed
SavedSearch
properties. - Added support for custom
HttpURLConnection
connection timeouts onHttpService
. - Performance improvement to
SavedSearch.dispatch()
. - Added getter methods to the
Job
class for retrievinglong
values (getEventCountLong
,getResultCountLong
,getScanCountLong
). - Added
setFieldList()
to theJobExportArgs
class. - Added support for the
manualRebuilds
DataModel
setting.
- Fixed
SavedSearch.Dispatch()
throwing aNullPointerException
in some load-balanced search head clustering environments. - Fixed non-limit
PivotFilter
constructing the wrong JSON blob.
- Added support for Travis CI.
- Added support for cookie-based authentication, for Splunk 6.2+.
- Fixed failure parsing XML responses. Pull Request #76.
- Fixed bug where
Job
is never ready leading to infinite loops.
- The SDK is now properly compiled with the
Command
class used in examples.
- Added support for Java 8, when manually configuring the
Service
class to use TLSv1.2, TLSv1.1, or TLSv1 defined in theSSLSecurityProtocol
enum. The default is still SSLv3. - Allow setting a custom
SSLSocketFactory
on theHTTPService
andService
classes.
ssl_protocols
: tries to connect to Splunk over HTTPS using different SSL/TLS protocols, then using a custom SSL and TLSSSLSocketFactory
.
- The SDK is now compiled with the
Command
class used in examples.
Job
objects will only be refreshed byisReady()
if theJob
is not ready. This minimizes HTTP requests when getting properties of theJob
.- The
Service
class now has agetJob()
method that is used to retrieve aJob
object by its sid String. This is better than callingservice.getJobs().get(sid)
, which has the overhead of getting allJob
objects from Splunk in order to access a singleJob
.
endpoint_instantiation
: shows how to manually instantiate any Splunk REST API endpoint.get_job
: shows how to get aJob
by its sid using the newService.getJob()
method.
- The
Entity
andEntityCollection
classes each have a public constructor, so any Splunk endpoint can be manually instantiated. - The
FiredAlert
class now has agetParsedExpirationTime()
method that returns aDate
object. - Some test have been modified to work with the latest release of Splunk Enterprise (6.2.x).
- Removed deprecated functions from
DistributedConfiguration
class. - Oneshot searches, called from
Index.upload
, can now be passed search arguments. - Fixed a resource leak in the
Command.load
function.
- Added support for data models and pivots.
- When setting the sourcetype of a modular input event, events are indexed properly. Previously Splunk would encounter an error and skip them. Also updated some of the modular input test data to reflect this change.
- ResultsReaderXml now works with alternate XML parser libraries.
- Hot fix to ResultsReaderXml to work with woodstox XML parsing library.
- The Splunk Enterprise SDK for Java is fully compatible with Splunk Enterprise 6.0 as of this release.
- JobCollection.create() previously invalidated the collection and refreshed it to see whether the job had appeared. This was problematic for Splunk Enterprise instances running many jobs at once. The method has been changed to only interact with the endpoint specific to the newly created job.
- Namespaces that contain special characters such as '@' in their owner or app are now handled correctly.
- Removed Application.isManageable and Application.setManageable, since they are deprecated or nonexistent in all supported Splunk versions as of this release.
- OutputDefault.getMaxQueueSize now returns a String instead of a long to match the behavior of setMaxQueueSize.
-
Certain combinations of requests and restarts of splunkd can cause splunkd to hang on OS X v10.8 Mountain Lion and OS X v10.9 Mavericks running Splunk 6.0.0. This issue is not present when running Splunk Enterprise on earlier versions of OS X. This will be fixed in a future release.
-
The modular input support in the Splunk Enterprise SDK for Java is not compatible with Windows Server 2003 or Windows Server 2003 R2.
- Added support for building modular input scripts in Java using the Splunk Enterprise SDK for Java.
- Any errors returned by Splunk in formats besides XML (for example, when Splunk returns JSON if an error occurs during a search with output_mode=json), are passed on as is in the resulting HttpException, replacing the uninformative error about XML parsing that was produced before.
-
The default setting for all search jobs is now
segmentation=none
unless you explicitly set it otherwise. This setting returns results as a raw-text string rather than a string in XML format. -
The
ResultReaderCsv
class no longer supports streams from theService.export
method. Instead, use theResultReaderXml
class with XML output, or use theResultReaderJson
class with JSON output.
-
New classes have been added,
MultiResultsReaderXml
andMultiResultsReaderJson
, to read search results streams with multiple result sets fromService.Export
methods. -
The
ResultsReader
classes now supportIterable
andIterator
interfaces. -
The
Event.getSegmentedRaw
method has been added to return raw data from events, preserving segmentation information.
-
The
ServiceInfo
class now uses theservices/*
endpoint rather than the default namespace (servicesNS/*
) for HTTP requests. This change is a workaround to avoid a bug in Splunk that returns HTTP code 403 when theserver/info
endpoint is accessed using certain namespaces. -
The
ResultsReaderXml
class can now read search results streams from theJob.getResultsPreview
method.
-
Specialized args classes have been added to make it easier to pass entity-specific arguments:
CollectionArgs
IndexCollectionArgs
JobArgs
JobEventsArgs
JobExportArgs
JobResultsArgs
JobResultsPreviewArgs
JobSummaryArgs
SavedSearchCollectionArgs
SavedSearchDispatchArgs
These new args classes are used with the following methods:
Service
constructorService.getSavedSearches
methodService.getJobs
methodService.getIndexes
methodService.export
methodJobCollection.create
methodJob.getResults
methodJob.getResultsPreview
methodJob.getEvents
methodJob.getSummary
methodSavedSearch.dispatch
method
-
ResultsReader.getNextEvent
now returns anEvent
object, which provides better handling for multi-value fields. This change is backward-compatible with older code that expects aHashMap<String, String>
. However this newEvent
object is read-only. -
Modular input functionality has been implemented (requiring Splunk 5.0+) and the following classes have been added:
ModularInputKind
ModularInputKindArgument
The
InputCollection
class also now handles arbitrary input kinds represented by modular inputs. You can callInputCollection.getInputKinds
to get the set ofInputKinds
on the connected Splunk instance. -
The
ReceiverBehavior
interface has been added to work with output streams. -
The
IndexCollection
class has been added as a specialized collection class for indexes. -
The
JobCollection
class has been added as a specialized collection class for jobs. -
You can now programatically remove indexes using the
IndexCollection.remove
method (requires Splunk 5.0+). -
You can now send data to an input using the
TcpInputs.attach
,TcpInputs.submit
, andUdpInput.submit
convenience methods. -
You can now restrict inputs to a specified host using the
setRestrictToHost
method onTcpInput
,TcpSplunkInput
, andUdpInput
(this method requires Splunk 5.0+). -
The
DistributedConfiguration.enable
andDistributedConfiguration.disable
convenience methods have been added, allowing you to immediately enable or disable the configuration. -
The following methods have been added to the
Index
class:getBucketRebuildMemoryHint
getMaxTimeUnreplicatedNoAcks
getMaxTimeUnreplicatedWithAcks
setBucketRebuildMemoryHint
setMaxTimeUnreplicatedNoAcks
setMaxTimeUnreplicatedWithAcks
-
The JAR files have changed so that everything is now included in the splunk.jar file. The splunk-external.jar and splunk-sdk.jar files have been removed.
-
Arguments are now submitted to Splunk in a consistent order, which improves behavior in certain cases.
-
The
InputKind
enum is now a class. TheInputKind
class has static members identical to the enum values, but you can no longer use aswitch
statement over the values. Instead, use a series ofif-else
blocks. This change was necessary to support arbitrary modular input kinds. -
All text is now consistently UTF-8 encoded. Previously, the platform-native encoding was used in certain cases. For example:
- HTTP requests are sent in UTF-8. In particular the values of args classes are always encoded in UTF-8.
- Results and events from jobs are read as UTF-8.
-
The
Index.setAssureUTF8
method fails for Splunk 5.0+ because this field has become a global setting rather than a per-index setting. -
The
Index.clean
method now throwsSplunkException.INTERRUPTED
when interrupted. Additionally, themaxSeconds
parameter is obeyed more accurately. -
The
WindowsRegistryInput.getType
andWindowsRegistryInput.setType
method type has changed toString[]
instead ofString
. -
The
DistributedPeer.getBuild
method now returns anint
instead of aString
to be consistent with theServiceInfo.getBuild
method. -
The
setRestrictToHost
method onTcpInput
,TcpSplunkInput
, andUdpInput
throws an exception for Splunk 4.x. Previously, this method failed silently. -
The
StormService
class has been removed, but will be restored in a subsequent release. -
The methods in the
ResultsReader
class now throwIOException
instead of a plainException
, so callers no longer need to handle a plainException
. -
The
SplunkException
class now provides error messages when printed. -
The test suite has been completely cleaned up, resulting in better coverage and faster performance, mostly by eliminating unnecessary restarts. The test suite strictly requires tests to handle restart requests.
-
The
get
,remove
, andcontains
methods for entity collections now throw an exception when a wildcarded namespace is passed, rather than incorrectly returning an empty list or taking no action. -
The
HashMap
andEvent
objects returned byResultsReader.getNextEvent
are now read-only. -
The
SavedSearch.getDispatchMaxTime
method previously returned aString
, but now returns anint
. -
The
LicensePool.getSlavesUsageBytes
method now returns a map from each slave GUID to its license usage, instead of returning along
. -
The
Service.oneshot
method has been renamed toService.oneshotSearch
. -
The
Service.oneshot(String query, Map inputArgs, Map outputArgs)
overload has been removed, becauseoutputArgs
had no effect. -
The
SavedSearch.setArgsWildcard
method has been removed. To set a wildcard parameter, specify it as a key-value pair in a map and pass it to theSavedSearch.dispatch(java.util.Map args)
method. -
The
SavedSearch.setActionWildcard
method has been removed. Use the specific setters to update these parameters. -
The
SavedSearch.setDispatchWildcard
method has been removed. Use the specific setters to update these parameters. -
The
Service.getFiredAlerts
method has been renamed togetFiredAlertsGroups
. -
The
Entity.reload
method has been removed. -
The
Entity.toUpdate
field is no longer public. -
The
Service.search(query)
andService.search(query, args)
methods now return a search job instead of blocking and returning results. -
The
Service.search(query, inputArgs, outputArgs)
overload has been removed. -
The
OutputServer.setsslRootCAPPath
method has been renamed tosetSslRootCAPPath
. -
The
SavedSearch.getDispatchReduceFreq
method, which returned aString
, has been replaced withgetDispatchReduceFrequency
, which returns anint
. -
The
setRestrictToHost
method has been removed from theTcpInput
andUdpInput
classes. -
The
Settings.setMgmtHostPort
method has been renamed tosetMgmtPort
and this method now returns anint
.
-
The
Service.versionCompare
method has been fixed to work as expected. -
The
OutputDefault.update
method has been fixed so that when a "name" parameter is not specified, the method no longer fails.
The following list contains the main features that have been deprecated (trivial changes are not included):
-
The public fields in the
ServiceArgs
class have been deprecated in favor of the new setter methods to maintain consistency with the new args subclasses. -
The
Application.isManageable
andApplication.setManageable
methods have been deprecated in Splunk 5.0 and later. -
The
DistributedConfiguration.getServerTimeout
method has been deprecated in Splunk 5.0 and later.
-
Changed how isDone() behaves with respect to job creation. Previously if a job was not ready on the server, calling job.isDone() would cause an exception. Now, calling isDone() will return false under the two following conditions:
- The job has not yet been scheduled. 2) The job has been scheduled but the results are not ready. In addition, isDone() implicitly invokes job.refresh() so the caller does not need to. This simplifies the code waiting for a job result to this: (with a 500 millisecond polling interval)
while (!job.isDone()) { sleep(500); }
-
Added isReady() method to the Job class. This method detects whether or not the job is ready to return data (i.e. be queried). It also implicitly invokes job.refresh(). This allows for jobs with previews but that have not necessarily completed to be accessed: (with a 500 millisecond polling interval)
while (!job.isReady()) { sleep(500); }
-
All Job class accessors will call refresh once before accessing the object.
-
Fixed ordering of collections when using pagination. Previously the order could be random. Now it maintains the order of the entities returned by the server.
-
Fixed XML streaming reader to properly work with paginated result sets.
-
Large collections can cause a default JVM to run out of memory: The Atom parsing uses the streaming XML parser as opposed to a DOM parser.
-
Fixed Index class getSync() method to return an integer instead of a boolean.
-
Added Index class get method getEnableOnlineBucketRepair().
-
Added Index class get method getMaxBloomBackfillBucketAge().
StormService
classReceiver
classUpload
class- New setter methods for all classes
- New getter methods for various classes
-
Added support for a default index, allowing optional parameters for streaming connections. The
Index
class now uses the newReceiver
class. -
Added a paginate feature for Splunk return data. This feature allows for
count
andoffset
methods to page through Splunk meta data instead of retrieving all the data at once:ConfCollection confs; Args args = new Args(); args.put("count", 30); args.put("offset", 0); confs = service.getConfs(args); // ... operate on the first 30 elements offset = offset + 30; args.put("offset", offset) confs = service.getConfs(args); // ... operate on the next 30 elements
-
Added a namespacing feature as optional arguments (
app
,owner
,sharing
) to the collection'screate
andget
methods. For more information about namespaces, see "Overview of the Splunk Enterprise SDK for Java" on the Developer Portal.The following example shows how to use the optional namespace to restrict creating and selecting saved searches to the namespace "owner = magilicuddy, app = oneMeanApp":
String searchName = "My scoped search"; String search = "index=main * | head 10"; args args = new Args(); args.put("owner", "magilicuddy"); args.put("app", "oneMeanApp"); // ... other creation arguments also get set into the args map savedSearches.create(searchName, search, args);
This example shows how to returns all saved searches within the same scoped namespace:
args args = new Args(); args.put("owner", "magilicuddy"); args.put("app", "oneMeanApp"); SavedSearchCollection mySavedSearches = service.getSavedSearches(args);
-
Added an XML, JSON, and CSV streaming results reader. This feature allows you to retrieve event data using an incremental streaming mechanism. Return data is in key-value pairs. The XML form uses built-in JDK XML parsing support. The JSON and CSV form requires third-party JSON and CSV tokenizers, which are included as ancillary .jar files in the SDK. The JSON and CSV streaming results reader, which requires the external tokenizers, are contained in a separate Splunk .jar file named
splunk-external.jar
.The following example uses the built-in XML streaming reader:
Job job = service.getJobs().create(query, queryArgs); ... HashMap<String, String> map; stream = job.getResults(outputArgs); ResultsReader resultsReader = new ResultsReaderXml(stream); while ((map = resultsReader.getNextEvent()) != null) { for (String key: map.keySet()) System.out.println(key + " --> " + map.get(key)); }
-
Added support for Splunk Storm. Instead of connecting to
Service
, you connect to the newStormService
class using similar arguments. Then, get aReceiver
object and log events.StormService
requires theindex
key andsourcetype
parameters when sending events:// the storm token provided by Splunk Args loginArgs = new Args("StormToken", "p-n8SwuWEqPlyOXdDU4PjxavFdAn1CnJea9LirgTvzmIhMEBys6w7UJUCtxp_7g7Q9XopR5dW0w="); Storm service = StormService.connect(loginArgs); // get the receiver object Receiver receiver = service.getReceiver(); // index and source type are required for storm event submission Args logArgs = new Args(); logArgs.put("index", "0e8a2df0834211e1a6fe123139335741"); logArgs.put("sourcetype", "yoursourcetype"); // log an event. receiver.log("This is a test event from the SDK", logArgs);
- Added a
genevents
example to generate events and push into Splunk using various methods. - Added a second time format when parsing time. A second time format is required
to accommodate the
data/input/oneshot
endpoint that does not return a standard time format and does not allow a time-format specifier. - Added a streaming reader to search examples. The main search example
search
shows how to use all three result readers. There are build modifications in build.xml to include the ancillary .jar files for JSON and CSV. - Added an
Input
example to display Splunk inputs and their attributes. - Added an alias
log
forsubmit
to theReceiver
class. - Updated eclipse .classpath file, accounting for new additions.
- Fixed argument processing in the tail example.
- Fixed timing window during search job creation; added
JOB_NOT_READY
exception. - Fixed
Index
cleaning to require a timeout value; addedTIMEOUT
exception. - Fixed
LicensePool
type to use string quota instead of integer. This change allows forMAX
and<number>[M|G|T]
. - Fixed
action
when trying to updateSettings
. - Fixed user creation to force lowercase usernames.
- Fixed the missing get methods for
ServiceInfo
. - Fixed a number of getter methods.
Initial Splunk Enterprise SDK for Java release.