├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── dictionaries │ ├── fross.xml │ └── blovering.xml ├── scopes │ └── scope_settings.xml ├── encodings.xml ├── libraries │ ├── gson.xml │ ├── opencsv.xml │ ├── junit_4_11.xml │ ├── commons_cli_1_2.xml │ └── openide.xml ├── vcs.xml ├── splunk-sdk-java.iml ├── codeStyleSettings.xml ├── modules.xml ├── compiler.xml └── projectCodeStyle.xml ├── launchers ├── shim │ ├── jars │ │ ├── shim.vmopts │ │ └── shim.jar │ ├── shim.v11.suo │ ├── shim │ │ ├── stdafx.cpp │ │ ├── targetver.h │ │ ├── stdafx.h │ │ ├── shim.vcxproj.user │ │ ├── shim.vcxproj.filters │ │ └── ReadMe.txt │ └── shim.sln ├── shim-windows_x86.exe ├── shim-windows_x86_64.exe ├── shim-linux.sh └── shim-darwin.sh ├── splunk ├── src │ ├── test │ │ ├── resources │ │ │ ├── data │ │ │ │ ├── results │ │ │ │ │ ├── 4.2.5 │ │ │ │ │ │ └── results-empty.xml │ │ │ │ │ ├── 4.3.5 │ │ │ │ │ │ └── results-empty.xml │ │ │ │ │ ├── 5.0.2 │ │ │ │ │ │ ├── results-empty.xml │ │ │ │ │ │ └── results-empty_preview.xml │ │ │ │ │ ├── results.csv │ │ │ │ │ ├── results4.json │ │ │ │ │ ├── results5.json │ │ │ │ │ ├── resultsMVOneshot.csv │ │ │ │ │ ├── resultsMV.csv │ │ │ │ │ ├── resultsMVOneshot4.json │ │ │ │ │ ├── resultsMV4.json │ │ │ │ │ ├── resultsMV5.json │ │ │ │ │ ├── resultsMVFuture.json │ │ │ │ │ ├── resultsMVOneshot5.json │ │ │ │ │ ├── resultsMVOneshotFuture.json │ │ │ │ │ └── results.xml │ │ │ │ ├── datamodels │ │ │ │ │ ├── model_with_empty_headers.json │ │ │ │ │ ├── model_with_unicode_headers.json │ │ │ │ │ ├── empty_data_model.json │ │ │ │ │ ├── object_with_one_search.json │ │ │ │ │ └── object_with_two_searches.json │ │ │ │ ├── pivot │ │ │ │ │ └── empty_pivot.json │ │ │ │ └── atom │ │ │ │ │ └── atom_feed_with_message.xml │ │ │ ├── modularinput │ │ │ │ └── data │ │ │ │ │ ├── validation_error.xml │ │ │ │ │ ├── validation.xml │ │ │ │ │ ├── conf_with_0_inputs.xml │ │ │ │ │ ├── conf_with_2_inputs.xml │ │ │ │ │ ├── conf_with_invalid_inputs.xml │ │ │ │ │ ├── event_minimal.xml │ │ │ │ │ ├── argument_with_defaults.xml │ │ │ │ │ ├── event_maximal.xml │ │ │ │ │ ├── argument_without_defaults.xml │ │ │ │ │ ├── stream_with_one_event.xml │ │ │ │ │ ├── scheme_with_defaults.xml │ │ │ │ │ ├── stream_with_two_events.xml │ │ │ │ │ └── scheme_without_defaults.xml │ │ │ ├── results.csv │ │ │ ├── results4.json │ │ │ ├── results5.json │ │ │ ├── resultsMVOneshot.csv │ │ │ ├── resultsMV.csv │ │ │ ├── resultsMVOneshot4.json │ │ │ ├── resultsMV4.json │ │ │ ├── resultsMV5.json │ │ │ ├── resultsMVFuture.json │ │ │ ├── resultsMVOneshot5.json │ │ │ ├── resultsMVOneshotFuture.json │ │ │ └── results.xml │ │ └── java │ │ │ └── com │ │ │ └── splunk │ │ │ ├── raw_field.xml │ │ │ ├── ResourceRoot.java │ │ │ ├── ArgsTest.java │ │ │ ├── TestDataNotInstalledException.java │ │ │ ├── UploadTest.java │ │ │ ├── splunk.license │ │ │ ├── splunk_at_least_cupcake.license │ │ │ ├── LicenseGroupTest.java │ │ │ ├── HttpExceptionTest.java │ │ │ ├── LicenseMessageTest.java │ │ │ ├── DeploymentServerTest.java │ │ │ └── DeploymentTenantTest.java │ └── main │ │ └── java │ │ └── com │ │ └── splunk │ │ ├── SSLSecurityProtocol.java │ │ ├── SortDirection.java │ │ ├── modularinput │ │ ├── MalformedDataException.java │ │ └── NonblockingInputStream.java │ │ ├── ReceiverBehavior.java │ │ ├── ExportResultsStream.java │ │ ├── BooleanComparison.java │ │ ├── DataModelArgs.java │ │ ├── StringPivotColumnSplit.java │ │ ├── NumericPivotColumnSplit.java │ │ ├── StringPivotRowSplit.java │ │ ├── StatsFunction.java │ │ ├── BaseService.java │ │ ├── UdpConnections.java │ │ ├── SplunkException.java │ │ ├── TimestampBinning.java │ │ ├── NumberPivotRowSplit.java │ │ ├── SearchResults.java │ │ ├── TimestampPivotColumnSplit.java │ │ ├── IPv4Comparison.java │ │ ├── DataModelSearch.java │ │ ├── EvalDataModelCalculation.java │ │ ├── NumberComparison.java │ │ ├── BooleanPivotColumnSplit.java │ │ ├── FiredAlertGroup.java │ │ ├── GeoIPDataModelCalculation.java │ │ ├── PivotColumnSplit.java │ │ ├── TcpConnections.java │ │ ├── TimestampPivotRowSplit.java │ │ ├── StringComparison.java │ │ ├── FiredAlertGroupCollection.java │ │ ├── Message.java │ │ ├── Logger.java │ │ ├── MultiResultsReaderXml.java │ │ ├── MultiResultsReaderJson.java │ │ ├── RegexpDataModelCalculation.java │ │ ├── IndexCollectionArgs.java │ │ ├── ApplicationSetup.java │ │ ├── SavedSearchCollectionArgs.java │ │ ├── Input.java │ │ ├── DataModelCollection.java │ │ ├── BooleanPivotRowSplit.java │ │ ├── IndexCollection.java │ │ └── LicenseStack.java ├── .classpath ├── .project ├── splunk.iml └── staticdocs.css ├── scripts └── test_specific.sh ├── examples ├── src │ └── main │ │ └── java │ │ └── com │ │ └── splunk │ │ └── examples │ │ ├── random_numbers │ │ └── random_numbers │ │ │ ├── README │ │ │ └── inputs.conf.spec │ │ │ └── default │ │ │ └── app.conf │ │ ├── testupdate │ │ └── Program.java │ │ ├── explorer │ │ ├── EntityNode.java │ │ ├── NamespacesNode.java │ │ ├── EntityComparator.java │ │ ├── MapPropertyEditor.java │ │ ├── InputKindPropertyEditor.java │ │ ├── PropertyInfo.java │ │ ├── LoggerNode.java │ │ ├── OutputServerNode.java │ │ ├── GroupNode.java │ │ ├── MessageNode.java │ │ ├── OutputSyslogNode.java │ │ ├── DeploymentTenantNode.java │ │ ├── LicenseGroupNode.java │ │ ├── DeploymentClientNode.java │ │ ├── DeploymentServerNode.java │ │ ├── LicenseStackNode.java │ │ ├── OutputGroupNode.java │ │ ├── EventTypeNode.java │ │ ├── LicenseSlaveNode.java │ │ ├── StringArrayPropertyEditor.java │ │ ├── Program.java │ │ ├── PasswordNode.java │ │ ├── LicensePoolNode.java │ │ ├── ResourceNode.java │ │ ├── ConfCollectionNode.java │ │ ├── UserNode.java │ │ ├── EntityKids.java │ │ ├── ExplorerNode.java │ │ ├── ConfCollectionKids.java │ │ ├── AppNode.java │ │ ├── DatePropertyEditor.java │ │ ├── DistributedPeerNode.java │ │ ├── EntityMetadataNode.java │ │ ├── SettingsNode.java │ │ ├── PropertyList.java │ │ ├── ServiceNode.java │ │ ├── LicenseNode.java │ │ └── DistributedConfigurationNode.java │ │ ├── info │ │ └── Program.java │ │ └── get_job │ │ └── Program.java └── examples.iml ├── splunkrc.spec ├── .project ├── argsGenerator └── specs │ ├── IndexCollectionArgs__GET_data_indexes.argspec │ ├── SavedSearchCollectionArgs__GET_saved_searches.argspec │ ├── JobResultsPreviewArgs__GET_search_jobs_NAME_results_preview.argspec │ ├── JobResultsArgs__GET_search_jobs_NAME_results.argspec │ └── CollectionArgs__GET_collection.argspec ├── ApplicationTestWithoutSetup └── ApplicationTestWithoutSetup.iml ├── .gitignore ├── docker-compose.yml ├── run ├── deploy ├── Makefile ├── .github └── workflows │ └── release.yml ├── CREDITS.md ├── deploy.md ├── CONTRIBUTING.md └── .classpath /.idea/.name: -------------------------------------------------------------------------------- 1 | splunk-sdk-java -------------------------------------------------------------------------------- /launchers/shim/jars/shim.vmopts: -------------------------------------------------------------------------------- 1 | -Xms512M -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/4.2.5/results-empty.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/4.3.5/results-empty.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/5.0.2/results-empty.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/5.0.2/results-empty_preview.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/test_specific.sh: -------------------------------------------------------------------------------- 1 | echo "To run a specific test:" 2 | echo " mvn test -Dtest=[testclass]" 3 | -------------------------------------------------------------------------------- /launchers/shim/shim.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/launchers/shim/shim.v11.suo -------------------------------------------------------------------------------- /launchers/shim-windows_x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/launchers/shim-windows_x86.exe -------------------------------------------------------------------------------- /launchers/shim/jars/shim.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/launchers/shim/jars/shim.jar -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/validation_error.xml: -------------------------------------------------------------------------------- 1 | Oh, the vogonity! -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/fross.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /launchers/shim-windows_x86_64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/launchers/shim-windows_x86_64.exe -------------------------------------------------------------------------------- /splunk/src/test/resources/data/datamodels/model_with_empty_headers.json: -------------------------------------------------------------------------------- 1 | { 2 | "displayName": "", 3 | "description": "", 4 | "objects": [] 5 | } -------------------------------------------------------------------------------- /splunk/src/test/resources/results.csv: -------------------------------------------------------------------------------- 1 | "sum(kb)","series" 2 | "14372242.758775","twitter" 3 | "267802.333926","splunkd" 4 | "5979.036338","splunkd_access" -------------------------------------------------------------------------------- /splunk/src/test/resources/data/datamodels/model_with_unicode_headers.json: -------------------------------------------------------------------------------- 1 | { 2 | "displayName": "ဩᚙ௵", 3 | "description": "௵௱௰௯", 4 | "objects": [] 5 | } -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/results.csv: -------------------------------------------------------------------------------- 1 | "sum(kb)","series" 2 | "14372242.758775","twitter" 3 | "267802.333926","splunkd" 4 | "5979.036338","splunkd_access" -------------------------------------------------------------------------------- /splunk/src/test/resources/data/datamodels/empty_data_model.json: -------------------------------------------------------------------------------- 1 | { 2 | "description":"Empty model", 3 | "displayName":"A human readable name", 4 | "objects": [] 5 | } 6 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/validation.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/splunk/src/test/resources/modularinput/data/validation.xml -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/conf_with_0_inputs.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/splunk/src/test/resources/modularinput/data/conf_with_0_inputs.xml -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/conf_with_2_inputs.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/splunk/src/test/resources/modularinput/data/conf_with_2_inputs.xml -------------------------------------------------------------------------------- /.idea/dictionaries/blovering.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | splunk 5 | 6 | 7 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/conf_with_invalid_inputs.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splunk/splunk-sdk-java/HEAD/splunk/src/test/resources/modularinput/data/conf_with_invalid_inputs.xml -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/random_numbers/random_numbers/README/inputs.conf.spec: -------------------------------------------------------------------------------- 1 | [random_numbers://default] 2 | *Generates events containing a random floating point number. 3 | 4 | min = 5 | max = 6 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/event_minimal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | This is a test of the emergency broadcast system. 4 | 5 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/argument_with_defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | string 3 | false 4 | false 5 | -------------------------------------------------------------------------------- /.idea/libraries/gson.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /splunk/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/opencsv.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/pivot/empty_pivot.json: -------------------------------------------------------------------------------- 1 | { 2 | "dataModel": "mymodel", 3 | "baseClass": "myobject", 4 | "filters": [], 5 | "cells": [], 6 | "rows": [], 7 | "columns": [], 8 | "rowFormat": { 9 | 10 | }, 11 | "colFormat": {} 12 | 13 | } -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/random_numbers/random_numbers/default/app.conf: -------------------------------------------------------------------------------- 1 | [install] 2 | is_configured = 0 3 | 4 | [ui] 5 | is_visible = 1 6 | label = random-numbers 7 | 8 | [launcher] 9 | author = Fred Ross 10 | description = 11 | version = 1.0 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/commons_cli_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/testupdate/Program.java: -------------------------------------------------------------------------------- 1 | package com.splunk.examples.testupdate; 2 | 3 | /** 4 | * Created with IntelliJ IDEA. 5 | * User: fross 6 | * Date: 11/4/13 7 | * Time: 1:56 PM 8 | * To change this template use File | Settings | File Templates. 9 | */ 10 | public class Program { 11 | } 12 | -------------------------------------------------------------------------------- /splunk/src/test/resources/results4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "sum(kb)":"14372242.758775", 4 | "series":"twitter" 5 | }, 6 | { 7 | "sum(kb)":"267802.333926", 8 | "series":"splunkd" 9 | }, 10 | { 11 | "sum(kb)":"5979.036338", 12 | "series":"splunkd_access" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /launchers/shim/shim/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // shim.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/results4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "sum(kb)":"14372242.758775", 4 | "series":"twitter" 5 | }, 6 | { 7 | "sum(kb)":"267802.333926", 8 | "series":"splunkd" 9 | }, 10 | { 11 | "sum(kb)":"5979.036338", 12 | "series":"splunkd_access" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/event_maximal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hilda 4 | misc 5 | main 6 | localhost 7 | This is a test of the emergency broadcast system. 8 | 9 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/argument_without_defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 쎼 and 쎶 and <&> für 3 | is_pos_int('some_name') 4 | boolean 5 | true 6 | true 7 | -------------------------------------------------------------------------------- /splunkrc.spec: -------------------------------------------------------------------------------- 1 | # Splunk Enterprise host (default: localhost) 2 | host=localhost 3 | # Splunk Enterprise admin port (default: 8089) 4 | port=8089 5 | # Splunk Enterprise username 6 | username=admin 7 | # Splunk Enterprise password 8 | password=changeme 9 | # Access scheme (default: https) 10 | scheme=https 11 | # Your version of Splunk Enterprise 12 | version=7.0 -------------------------------------------------------------------------------- /launchers/shim/shim/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /.idea/splunk-sdk-java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/datamodels/object_with_one_search.json: -------------------------------------------------------------------------------- 1 | { 2 | "displayName": "ဩᚙ௵", 3 | "description": "௵௱௰௯", 4 | "objects": [ 5 | { 6 | "objectName": "search1", 7 | "displayName": "௵௱௰௯ - search 1", 8 | "parentName": "BaseEvent", 9 | "fields": [], 10 | "calculations": [], 11 | "constraints": [] 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/stream_with_one_event.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hilda 5 | misc 6 | main 7 | localhost 8 | This is a test of the emergency broadcast system. 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/scheme_with_defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | abcd 4 | true 5 | false 6 | xml 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /launchers/shim/shim/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | 15 | // TODO: reference additional headers your program requires here 16 | -------------------------------------------------------------------------------- /splunk/src/test/resources/results5.json: -------------------------------------------------------------------------------- 1 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Users/fross/splunks/splunk-5.0/etc\""}],"results":[{"sum(kb)":"14372242.758775","series":"twitter"},{"sum(kb)":"267802.333926","series":"splunkd"},{"sum(kb)":"5979.036338","series":"splunkd_access"}]} 2 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/results5.json: -------------------------------------------------------------------------------- 1 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Users/fross/splunks/splunk-5.0/etc\""}],"results":[{"sum(kb)":"14372242.758775","series":"twitter"},{"sum(kb)":"267802.333926","series":"splunkd"},{"sum(kb)":"5979.036338","series":"splunkd_access"}]} 2 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | splunk-sdk-java 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /splunk/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Splunk 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/raw_field.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _raw 6 | 7 | 8 | 9 | 07-13-2012 09:27:27.307 -0700 INFO Metrics - group=search_concurrency, system total, active_hist_searches=0, active_realtime_searches=0 10 | 11 | 12 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/SSLSecurityProtocol.java: -------------------------------------------------------------------------------- 1 | package com.splunk; 2 | 3 | public enum SSLSecurityProtocol { 4 | TLSv1_2 { 5 | public String toString() { return "TLSv1.2"; } 6 | }, 7 | TLSv1_1 { 8 | public String toString() { return "TLSv1.1"; } 9 | }, 10 | TLSv1 { 11 | public String toString() { return "TLSv1"; } 12 | }, 13 | SSLv3 { 14 | public String toString() { return "SSLv3"; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /argsGenerator/specs/IndexCollectionArgs__GET_data_indexes.argspec: -------------------------------------------------------------------------------- 1 | count 2 | Count 3 | int 4 | Sets the maximum number of entries to return. 5 | - 6 | The maximum number of entries to return. To return all entries, specify -1. 7 | !CODE 8 | super.setCount(count); 9 | === 10 | summarize 11 | Summarize 12 | boolean 13 | Sets whether to omits certain index details to provide a faster response. 14 | - 15 | {@code true} to omit index details for a faster response, 16 | {@code false} if not. 17 | === 18 | -------------------------------------------------------------------------------- /ApplicationTestWithoutSetup/ApplicationTestWithoutSetup.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Java 2 | *.class 3 | 4 | # Mac OS X 5 | *.DS_Store* 6 | 7 | # Generated directories 8 | build 9 | dist 10 | out 11 | target/ 12 | 13 | # Test & Coverage 14 | TEST-com.splunk.*.xml 15 | 16 | # IntelliJ 17 | .idea/workspace.xml 18 | .idea/misc.xml 19 | .idea/ 20 | 21 | # Unknown 22 | *.swp 23 | *.properties 24 | .settings 25 | bin 26 | build.log 27 | 28 | # Visual Studio 29 | Debug 30 | Release 31 | launchers/shim/Release 32 | launchers/shim/shim/Release 33 | launchers/shim/x64 34 | launchers/shim/ipch/* 35 | launchers/shim/shim.opensdf 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/datamodels/object_with_two_searches.json: -------------------------------------------------------------------------------- 1 | { 2 | "displayName": "ဩᚙ௵ 2", 3 | "description": "௵௱௰௯", 4 | "objects": [ 5 | { 6 | "objectName": "search1", 7 | "displayName": "௵௱௰௯ - search 1", 8 | "parentName": "BaseEvent", 9 | "fields": [], 10 | "calculations": [], 11 | "constraints": [] 12 | }, 13 | { 14 | "objectName": "search2", 15 | "displayName": "௵௱௰௯ - search 2", 16 | "parentName": "BaseEvent", 17 | "fields": [], 18 | "calculations": [], 19 | "constraints": [] 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMVOneshot.csv: -------------------------------------------------------------------------------- 1 | 2 | "_bkt","_cd","_indextime","_raw","_serial","_si","_sourcetype","_subsecond","_time",host,index,linecount,source,sourcetype,"splunk_server" 3 | "_internal~114~BC509B13-C34D-4A69-B216-488806E9EA63","114:33623",1354062581,"127.0.0.1 - admin [27/Nov/2012:16:29:39.149 -0800] ""GET /services/messages?count=-1 HTTP/1.1"" 200 1998 - - - 1ms",0,"dfoster-mbp17.local 4 | _internal","splunkd_access",".149","2012-11-27T16:29:39.149-08:00","dfoster-mbp17.local","_internal",1,"/Applications/splunkbeta_140868_rc7/var/log/splunk/splunkd_access.log","splunkd_access","dfoster-mbp17.local" 5 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMVOneshot.csv: -------------------------------------------------------------------------------- 1 | 2 | "_bkt","_cd","_indextime","_raw","_serial","_si","_sourcetype","_subsecond","_time",host,index,linecount,source,sourcetype,"splunk_server" 3 | "_internal~114~BC509B13-C34D-4A69-B216-488806E9EA63","114:33623",1354062581,"127.0.0.1 - admin [27/Nov/2012:16:29:39.149 -0800] ""GET /services/messages?count=-1 HTTP/1.1"" 200 1998 - - - 1ms",0,"dfoster-mbp17.local 4 | _internal","splunkd_access",".149","2012-11-27T16:29:39.149-08:00","dfoster-mbp17.local","_internal",1,"/Applications/splunkbeta_140868_rc7/var/log/splunk/splunkd_access.log","splunkd_access","dfoster-mbp17.local" 5 | -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMV.csv: -------------------------------------------------------------------------------- 1 | "_bkt","_cd","_indextime","_raw","_serial","_si","_sourcetype","_subsecond","_time",host,index,linecount,source,sourcetype,"splunk_server" 2 | "_internal~115~BC509B13-C34D-4A69-B216-488806E9EA63","115:4933",1354063445,"11-27-2012 16:44:05.208 -0800 INFO Metrics - group=udpin_connections, *:9999, sourcePort=9999, _udp_bps=0.00, _udp_kbps=0.00, _udp_avg_thruput=0.00, _udp_kprocessed=0.00, _udp_eps=0.00",0,"dfoster-mbp17.local 3 | _internal",splunkd,".208","2012-11-27T16:44:05.208-08:00","dfoster-mbp17.local","_internal",1,"/Applications/splunkbeta_140868_rc7/var/log/splunk/metrics.log",splunkd,"dfoster-mbp17.local" 4 | -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMVOneshot4.json: -------------------------------------------------------------------------------- 1 | 2 | [ 3 | { 4 | "_cd": "184:21387", 5 | "_indextime": "1353099184", 6 | "_raw": "2012-11-16 12:53:04.502 -0800 Interrupt signal received", 7 | "_serial": "0", 8 | "_si": "dfoster-mbp17.local\n_internal", 9 | "_sourcetype": "splunkd_stderr", 10 | "_subsecond": ".502", 11 | "_time": "2012-11-16T12:53:04.502-08:00", 12 | "host": "dfoster-mbp17.local", 13 | "index": "_internal", 14 | "linecount": "1", 15 | "source": "/Applications/splunk_434/var/log/splunk/splunkd_stderr.log", 16 | "sourcetype": "splunkd_stderr", 17 | "splunk_server": "dfoster-mbp17.local" 18 | } 19 | ] -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /argsGenerator/specs/SavedSearchCollectionArgs__GET_saved_searches.argspec: -------------------------------------------------------------------------------- 1 | # TODO: Improve docs: What is the accepted time format? 2 | # TODO: Make Date version. 3 | earliest_time 4 | EarliestTime 5 | String 6 | Sets the earliest time for which to display the scheduled times for scheduled searches (not just the next run time). 7 | - 8 | The earliest time. 9 | === 10 | # TODO: Improve docs: What is the accepted time format? 11 | # TODO: Make Date version. 12 | latest_time 13 | LatestTime 14 | String 15 | Sets the latest time until which to display the scheduled times for scheduled searches (not just the next run time). 16 | - 17 | The latest time. 18 | === 19 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMV.csv: -------------------------------------------------------------------------------- 1 | "_bkt","_cd","_indextime","_raw","_serial","_si","_sourcetype","_subsecond","_time",host,index,linecount,source,sourcetype,"splunk_server" 2 | "_internal~115~BC509B13-C34D-4A69-B216-488806E9EA63","115:4933",1354063445,"11-27-2012 16:44:05.208 -0800 INFO Metrics - group=udpin_connections, *:9999, sourcePort=9999, _udp_bps=0.00, _udp_kbps=0.00, _udp_avg_thruput=0.00, _udp_kprocessed=0.00, _udp_eps=0.00",0,"dfoster-mbp17.local 3 | _internal",splunkd,".208","2012-11-27T16:44:05.208-08:00","dfoster-mbp17.local","_internal",1,"/Applications/splunkbeta_140868_rc7/var/log/splunk/metrics.log",splunkd,"dfoster-mbp17.local" 4 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMVOneshot4.json: -------------------------------------------------------------------------------- 1 | 2 | [ 3 | { 4 | "_cd": "184:21387", 5 | "_indextime": "1353099184", 6 | "_raw": "2012-11-16 12:53:04.502 -0800 Interrupt signal received", 7 | "_serial": "0", 8 | "_si": "dfoster-mbp17.local\n_internal", 9 | "_sourcetype": "splunkd_stderr", 10 | "_subsecond": ".502", 11 | "_time": "2012-11-16T12:53:04.502-08:00", 12 | "host": "dfoster-mbp17.local", 13 | "index": "_internal", 14 | "linecount": "1", 15 | "source": "/Applications/splunk_434/var/log/splunk/splunkd_stderr.log", 16 | "sourcetype": "splunkd_stderr", 17 | "splunk_server": "dfoster-mbp17.local" 18 | } 19 | ] -------------------------------------------------------------------------------- /splunk/splunk.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMV4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_cd": "187:18991", 4 | "_indextime": "1354063535", 5 | "_raw": "11-27-2012 16:45:34.924 -0800 INFO WatchedFile - Will begin reading at offset=22899111 for file='/Applications/splunk_434/var/log/splunk/metrics.log'.", 6 | "_serial": "0", 7 | "_si": "dfoster-mbp17.local\n_internal", 8 | "_sourcetype": "splunkd", 9 | "_subsecond": ".924", 10 | "_time": "2012-11-27T16:45:34.924-08:00", 11 | "host": "dfoster-mbp17.local", 12 | "index": "_internal", 13 | "linecount": "1", 14 | "source": "/Applications/splunk_434/var/log/splunk/splunkd.log", 15 | "sourcetype": "splunkd", 16 | "splunk_server": "dfoster-mbp17.local" 17 | } 18 | ] -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMV4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_cd": "187:18991", 4 | "_indextime": "1354063535", 5 | "_raw": "11-27-2012 16:45:34.924 -0800 INFO WatchedFile - Will begin reading at offset=22899111 for file='/Applications/splunk_434/var/log/splunk/metrics.log'.", 6 | "_serial": "0", 7 | "_si": "dfoster-mbp17.local\n_internal", 8 | "_sourcetype": "splunkd", 9 | "_subsecond": ".924", 10 | "_time": "2012-11-27T16:45:34.924-08:00", 11 | "host": "dfoster-mbp17.local", 12 | "index": "_internal", 13 | "linecount": "1", 14 | "source": "/Applications/splunk_434/var/log/splunk/splunkd.log", 15 | "sourcetype": "splunkd", 16 | "splunk_server": "dfoster-mbp17.local" 17 | } 18 | ] -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/stream_with_two_events.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hilda 5 | misc 6 | main 7 | localhost 8 | This is a test of the emergency broadcast system. 9 | 10 | 11 | 12 | 13 | hilda 14 | misc 15 | main 16 | localhost 17 | This is a test of the emergency broadcast system. 18 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/libraries/openide.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/SortDirection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | 19 | public enum SortDirection { ASCENDING, DESCENDING, DEFAULT 20 | } 21 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | 3 | services: 4 | splunk: 5 | image: "splunk/splunk:latest" 6 | container_name: splunk 7 | environment: 8 | - SPLUNK_START_ARGS=--accept-license 9 | - SPLUNK_HEC_TOKEN=11111111-1111-1111-1111-1111111111113 10 | - SPLUNK_PASSWORD=changed! 11 | - SPLUNK_APPS_URL=https://github.com/splunk/sdk-app-collection/releases/download/v1.1.0/sdkappcollection.tgz 12 | - JAVA_VERSION=openjdk:8 13 | ports: 14 | - 8000:8000 15 | - 8088:8088 16 | - 8089:8089 17 | - 10667:10667 18 | - 10668:10668/udp 19 | healthcheck: 20 | test: ['CMD', 'curl', '-f', 'http://localhost:8000'] 21 | interval: 5s 22 | timeout: 5s 23 | retries: 20 24 | -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMV5.json: -------------------------------------------------------------------------------- 1 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~115~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"115:5186","_indextime":"1354063462","_raw":"127.0.0.1 - admin [27/Nov/2012:16:44:22.581 -0800] \"GET /services/messages?count=-1 HTTP/1.1\" 200 1998 - - - 1ms","_serial":"0","_si":"dfoster-mbp17.local\n_internal","_sourcetype":"splunkd_access","_subsecond":".581","_time":"2012-11-27T16:44:22.581-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/splunkd_access.log","sourcetype":"splunkd_access","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMVFuture.json: -------------------------------------------------------------------------------- 1 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~115~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"115:5186","_indextime":"1354063462","_raw":"127.0.0.1 - admin [27/Nov/2012:16:44:22.581 -0800] \"GET /services/messages?count=-1 HTTP/1.1\" 200 1998 - - - 1ms","_serial":"0","_si":["dfoster-mbp17.local","_internal"],"_sourcetype":"splunkd_access","_subsecond":".581","_time":"2012-11-27T16:44:22.581-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/splunkd_access.log","sourcetype":"splunkd_access","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMV5.json: -------------------------------------------------------------------------------- 1 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~115~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"115:5186","_indextime":"1354063462","_raw":"127.0.0.1 - admin [27/Nov/2012:16:44:22.581 -0800] \"GET /services/messages?count=-1 HTTP/1.1\" 200 1998 - - - 1ms","_serial":"0","_si":"dfoster-mbp17.local\n_internal","_sourcetype":"splunkd_access","_subsecond":".581","_time":"2012-11-27T16:44:22.581-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/splunkd_access.log","sourcetype":"splunkd_access","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMVFuture.json: -------------------------------------------------------------------------------- 1 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~115~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"115:5186","_indextime":"1354063462","_raw":"127.0.0.1 - admin [27/Nov/2012:16:44:22.581 -0800] \"GET /services/messages?count=-1 HTTP/1.1\" 200 1998 - - - 1ms","_serial":"0","_si":["dfoster-mbp17.local","_internal"],"_sourcetype":"splunkd_access","_subsecond":".581","_time":"2012-11-27T16:44:22.581-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/splunkd_access.log","sourcetype":"splunkd_access","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /examples/examples.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMVOneshot5.json: -------------------------------------------------------------------------------- 1 | 2 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~114~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"114:34048","_indextime":"1354062607","_raw":"11-27-2012 16:30:06.140 -0800 INFO Metrics - group=udpin_connections, *:9999, sourcePort=9999, _udp_bps=0.00, _udp_kbps=0.00, _udp_avg_thruput=0.00, _udp_kprocessed=0.00, _udp_eps=0.00","_serial":"0","_si":"dfoster-mbp17.local\n_internal","_sourcetype":"splunkd","_subsecond":".140","_time":"2012-11-27T16:30:06.140-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/metrics.log","sourcetype":"splunkd","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /splunk/src/test/resources/resultsMVOneshotFuture.json: -------------------------------------------------------------------------------- 1 | 2 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~114~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"114:34048","_indextime":"1354062607","_raw":"11-27-2012 16:30:06.140 -0800 INFO Metrics - group=udpin_connections, *:9999, sourcePort=9999, _udp_bps=0.00, _udp_kbps=0.00, _udp_avg_thruput=0.00, _udp_kprocessed=0.00, _udp_eps=0.00","_serial":"0","_si":["dfoster-mbp17.local","_internal"],"_sourcetype":"splunkd","_subsecond":".140","_time":"2012-11-27T16:30:06.140-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/metrics.log","sourcetype":"splunkd","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMVOneshot5.json: -------------------------------------------------------------------------------- 1 | 2 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~114~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"114:34048","_indextime":"1354062607","_raw":"11-27-2012 16:30:06.140 -0800 INFO Metrics - group=udpin_connections, *:9999, sourcePort=9999, _udp_bps=0.00, _udp_kbps=0.00, _udp_avg_thruput=0.00, _udp_kprocessed=0.00, _udp_eps=0.00","_serial":"0","_si":"dfoster-mbp17.local\n_internal","_sourcetype":"splunkd","_subsecond":".140","_time":"2012-11-27T16:30:06.140-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/metrics.log","sourcetype":"splunkd","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/ResourceRoot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * This is a class used solely to get the path to resource like XML and JSON 21 | * files in the test suite in static methods of other classes. 22 | */ 23 | class ResourceRoot { 24 | } 25 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/resultsMVOneshotFuture.json: -------------------------------------------------------------------------------- 1 | 2 | {"preview":false,"init_offset":0,"messages":[{"type":"DEBUG","text":"base lispy: [ AND index::_internal ]"},{"type":"DEBUG","text":"search context: user=\"admin\", app=\"search\", bs-pathname=\"/Applications/splunkbeta_140868_rc7/etc\""}],"results":[{"_bkt":"_internal~114~BC509B13-C34D-4A69-B216-488806E9EA63","_cd":"114:34048","_indextime":"1354062607","_raw":"11-27-2012 16:30:06.140 -0800 INFO Metrics - group=udpin_connections, *:9999, sourcePort=9999, _udp_bps=0.00, _udp_kbps=0.00, _udp_avg_thruput=0.00, _udp_kprocessed=0.00, _udp_eps=0.00","_serial":"0","_si":["dfoster-mbp17.local","_internal"],"_sourcetype":"splunkd","_subsecond":".140","_time":"2012-11-27T16:30:06.140-08:00","host":"dfoster-mbp17.local","index":"_internal","linecount":"1","source":"/Applications/splunkbeta_140868_rc7/var/log/splunk/metrics.log","sourcetype":"splunkd","splunk_server":"dfoster-mbp17.local"}]} -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/EntityNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class EntityNode extends ResourceNode { 22 | EntityNode(Entity value) { 23 | super(value, new EntityKids(value)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/ArgsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import junit.framework.TestCase; 20 | 21 | public class ArgsTest extends TestCase { 22 | public void testCreateArgsWithNull() { 23 | Args emptyArgs = Args.create(null); 24 | assertTrue(emptyArgs.isEmpty()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/NamespacesNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Service; 20 | 21 | class NamespacesNode extends ExplorerNode { 22 | NamespacesNode(Service service) { 23 | super(service, new NamespacesKids(service)); 24 | setDisplayName("Namespaces"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/EntityComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | import java.util.Comparator; 22 | 23 | class EntityComparator implements Comparator { 24 | public int compare(Entity entity1, Entity entity2) { 25 | return entity1.getName().compareTo(entity2.getName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/MapPropertyEditor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import java.beans.PropertyEditorSupport; 20 | import java.util.Map; 21 | 22 | public class MapPropertyEditor extends PropertyEditorSupport { 23 | @Override public String getAsText() { 24 | Map value = (Map)getValue(); 25 | return value.toString(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2011 Splunk, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"): you may 6 | # not use this file except in compliance with the License. You may obtain 7 | # a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations 15 | # under the License. 16 | 17 | """Helper script for running Java SDK examples.""" 18 | 19 | from subprocess import Popen 20 | import sys 21 | 22 | if len(sys.argv) == 1: sys.exit(0) 23 | cmdline = "java -jar dist/examples/%s.jar" % sys.argv[1] 24 | cmdline = cmdline.split() 25 | cmdline.extend(sys.argv[2:]) 26 | process = Popen(cmdline, env={}) 27 | process.communicate() 28 | sys.exit(process.wait()) 29 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/TestDataNotInstalledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | public class TestDataNotInstalledException extends RuntimeException { 20 | public TestDataNotInstalledException() { 21 | super( 22 | "The test data is not installed in your splunkd. " + 23 | "Please see the documentation to install the test data."); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/modularinput/MalformedDataException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.modularinput; 18 | 19 | /** 20 | * Exception thrown when parsing XML that is syntactically valid, but does not 21 | * match the schema expected by the Splunk SDK for Java. 22 | */ 23 | public class MalformedDataException extends Exception { 24 | public MalformedDataException(String s) { 25 | super(s); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /splunk/src/test/resources/modularinput/data/scheme_without_defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | abcd 4 | 쎼 and 쎶 and <&> für 5 | false 6 | true 7 | simple 8 | 9 | 10 | 11 | string 12 | false 13 | false 14 | 15 | 16 | 쎼 and 쎶 and <&> für 17 | is_pos_int('some_name') 18 | number 19 | true 20 | true 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/InputKindPropertyEditor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.InputKind; 20 | 21 | import java.beans.PropertyEditorSupport; 22 | 23 | public class InputKindPropertyEditor extends PropertyEditorSupport { 24 | @Override public String getAsText() { 25 | InputKind value = (InputKind)getValue(); 26 | return value.toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/ReceiverBehavior.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import java.io.IOException; 19 | import java.io.OutputStream; 20 | /** 21 | * The {@code ReceiverBehavior} interface represents actions to be taken given 22 | * an output stream connected to Splunk over which a program can stream events. 23 | */ 24 | 25 | public interface ReceiverBehavior { 26 | public void run(OutputStream stream) throws IOException; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/PropertyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | public class PropertyInfo { 20 | public Class datatype; 21 | public String getter; 22 | public String setter; 23 | 24 | public PropertyInfo(Class datatype, String getter, String setter) { 25 | this.datatype = datatype; 26 | this.getter = getter; 27 | this.setter = setter; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/LoggerNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class LoggerNode extends EntityNode { 22 | LoggerNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getLevel"); 29 | return list; 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/ExportResultsStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.io.FilterInputStream; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * The {@code ExportResultsStream} class represents a stream constructed by the 24 | * {@link Service#export} method. 25 | * 26 | */ 27 | class ExportResultsStream extends FilterInputStream { 28 | public ExportResultsStream(InputStream stream) { 29 | super(stream); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/OutputServerNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class OutputServerNode extends EntityNode { 22 | OutputServerNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | // UNDONE list.add(Connections[], "allConnections"); 29 | return list; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/GroupNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import org.openide.nodes.AbstractNode; 20 | import org.openide.nodes.Children; 21 | import org.openide.nodes.Node; 22 | 23 | // A simple named container node. 24 | class GroupNode extends AbstractNode { 25 | GroupNode(String name, final Node... kids) { 26 | super(Children.LEAF); 27 | setDisplayName(name); 28 | setChildren(new Children.Array() {{ add(kids); }}); 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/MessageNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class MessageNode extends EntityNode { 22 | MessageNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getKey"); 29 | list.add(String.class, "getValue"); 30 | return list; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /launchers/shim-linux.sh: -------------------------------------------------------------------------------- 1 | # Shim to run a modular input written in Java. The modular input 2 | # is assumed to be in the form of an executable jar. This shim 3 | # is in ${PLATFORM}/bin/${INPUTNAME}.sh of the app the modular 4 | # input is contained in, and the jar is assumed to be in 5 | # jars/${INPUTNAME}.jar in the app. 6 | # 7 | # If ${PLATFORM}/bin/customized.java.path exists, this script will 8 | # use java cmd defined in this file to start jvm, else default java 9 | # will be used. 10 | # 11 | # Extra arguments to the JVM (i.e., -Xms512M) can be put in 12 | # a file jars/${INPUTNAME}.vmopts and will be interpolated 13 | # into the command to run the JVM. 14 | SCRIPT=$(readlink -f "$0") 15 | BASENAME=$(basename "$SCRIPT" .sh) 16 | JAR_DIR=$(dirname "$SCRIPT")/../../jars 17 | CUSTOMIZED_JAVA_PATH_FILE=$(dirname "$SCRIPT")/customized.java.path 18 | 19 | if [ -f $CUSTOMIZED_JAVA_PATH_FILE ]; then 20 | JAVA_CMD=`cat $CUSTOMIZED_JAVA_PATH_FILE` 21 | else 22 | JAVA_CMD="java" 23 | fi 24 | 25 | if [ -f $JAR_DIR/$BASENAME.vmopts ]; then 26 | VMOPTS=`cat $JAR_DIR/$BASENAME.vmopts` 27 | else 28 | VMOPTS="" 29 | fi 30 | 31 | exec $JAVA_CMD $VMOPTS -jar $JAR_DIR/$BASENAME.jar $@ -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/BooleanComparison.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | /** 19 | * Comparisons on boolean valued fields. 20 | */ 21 | public enum BooleanComparison { 22 | IS_NULL { 23 | public String toString() { return "isNull"; } 24 | }, 25 | IS_NOT_NULL { 26 | public String toString() { return "isNotNull"; } 27 | }, 28 | EQUALS { 29 | public String toString() { return "="; } 30 | }, 31 | IS { 32 | public String toString() { return "is"; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/DataModelArgs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * Class representing arguments to creating a data model. 21 | * 22 | * At the moment this is a very minimal class, supporting only the 23 | * description field for writing raw JSON to the server. 24 | */ 25 | public class DataModelArgs extends Args { 26 | public String getRawJsonDescription() { return (String) get("description"); } 27 | public void setRawJsonDescription(String rawJson) { put("description", rawJson); } 28 | } 29 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/OutputSyslogNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class OutputSyslogNode extends EntityNode { 22 | OutputSyslogNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getServer"); 29 | list.add(String.class, "getType"); 30 | return list; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/DeploymentTenantNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class DeploymentTenantNode extends EntityNode { 22 | DeploymentTenantNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | return new PropertyList() {{ 28 | add(boolean.class, "getCheckNew"); 29 | add(String.class, "getWhiteList0"); 30 | }}; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/LicenseGroupNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class LicenseGroupNode extends EntityNode { 22 | LicenseGroupNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String[].class, "getStackIds"); 29 | list.add(boolean.class, "isActive"); 30 | return list; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/DeploymentClientNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class DeploymentClientNode extends EntityNode { 22 | DeploymentClientNode(Entity value) { 23 | super(value); 24 | setDisplayName("Deployment Client"); 25 | } 26 | 27 | @Override protected PropertyList getMetadata() { 28 | PropertyList list = super.getMetadata(); 29 | list.add(String.class, "getTargetUri"); 30 | return list; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /deploy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | declare -r scriptDirectory="$(dirname $(readlink -e $0))" 4 | declare -r scriptName="$(basename $0)" 5 | declare -r version="1.9.5" 6 | 7 | if [[ $# -ne 1 ]]; then 8 | echo 1>&2 "Usage: ${scriptName} {local|staging||production}" 9 | fi 10 | 11 | case $1 in 12 | local) 13 | declare -r url="file:///${HOME}/.m2/repository/" 14 | declare -r repositoryId="" 15 | ;; 16 | staging) 17 | declare -r url="http://stg-artifactory:8081/artifactory/devplat-staging/" 18 | declare -r repositoryId="splunk-staging-artifactory" 19 | ;; 20 | production) 21 | declare -r url="https://splunk.artifactoryonline.com/splunk/ext-releases-local/" 22 | declare -r repositoryId="splunk-production-artifactory" 23 | ;; 24 | esac 25 | 26 | cd "${scriptDirectory}" 27 | 28 | mvn deploy:deploy-file -Ddescription="The Splunk SDK for Java" -Dfile=dist/splunk-${version}.jar \ 29 | -DgroupId=com.splunk -DartifactId=splunk -Dversion=${version}.0 -Dpackaging=jar \ 30 | -Djavadoc=dist/splunk-${version}-javadoc.jar \ 31 | -Dsources=dist/splunk-${version}-sources.jar \ 32 | -DrepositoryId="${repositoryId}" \ 33 | -DupdateReleaseInfo=true \ 34 | -Durl="${url}" 35 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/DeploymentServerNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class DeploymentServerNode extends EntityNode { 22 | DeploymentServerNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(boolean.class, "getCheckNew"); 29 | list.add(String.class, "getWhiteList0"); 30 | return list; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/LicenseStackNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class LicenseStackNode extends EntityNode { 22 | LicenseStackNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getLabel"); 29 | list.add(long.class, "getQuota"); 30 | list.add(String.class, "getType"); 31 | return list; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # text reset 2 | NO_COLOR=\033[0m 3 | # green 4 | OK_COLOR=\033[32;01m 5 | # red 6 | ERROR_COLOR=\033[31;01m 7 | # cyan 8 | WARN_COLOR=\033[36;01m 9 | # yellow 10 | ATTN_COLOR=\033[33;01m 11 | 12 | ROOT_DIR := $(shell git rev-parse --show-toplevel) 13 | 14 | VERSION := `git describe --tags --dirty 2>/dev/null` 15 | COMMITHASH := `git rev-parse --short HEAD 2>/dev/null` 16 | DATE := `date "+%FT%T%z"` 17 | 18 | .PHONY: all 19 | all: init test 20 | 21 | init: 22 | @echo "$(ATTN_COLOR)==> init $(NO_COLOR)" 23 | 24 | .PHONY: test 25 | test: 26 | @echo "$(ATTN_COLOR)==> test $(NO_COLOR)" 27 | # @ant test 28 | @mvn test 29 | 30 | .PHONY: test_specific 31 | test_specific: 32 | @echo "$(ATTN_COLOR)==> test_specific $(NO_COLOR)" 33 | @sh ./scripts/test_specific.sh 34 | 35 | .PHONY: up 36 | up: 37 | @echo "$(ATTN_COLOR)==> up $(NO_COLOR)" 38 | @docker-compose up -d 39 | 40 | .PHONY: wait_up 41 | wait_up: 42 | @echo "$(ATTN_COLOR)==> wait_up $(NO_COLOR)" 43 | @for i in `seq 0 180`; do if docker exec -it splunk /sbin/checkstate.sh &> /dev/null; then break; fi; printf "\rWaiting for Splunk for %s seconds..." $$i; sleep 1; done 44 | 45 | .PHONY: down 46 | down: 47 | @echo "$(ATTN_COLOR)==> down $(NO_COLOR)" 48 | @docker-compose stop 49 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/OutputGroupNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class OutputGroupNode extends EntityNode { 22 | OutputGroupNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getMethod"); 29 | list.add(String[].class, "getServers"); 30 | list.add(boolean.class, "isDisabled"); 31 | return list; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/EventTypeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class EventTypeNode extends EntityNode { 22 | EventTypeNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getDescriptionLabel"); 29 | list.add(int.class, "getPriority"); 30 | list.add(String.class, "getSearch"); 31 | return list; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/LicenseSlaveNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class LicenseSlaveNode extends EntityNode { 22 | LicenseSlaveNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getLabel"); 29 | list.add(String[].class, "getPoolIds"); 30 | list.add(String[].class, "getStackIds"); 31 | return list; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/StringPivotColumnSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonObject; 19 | 20 | /** 21 | * Represents a column split on a string valued field. 22 | */ 23 | public class StringPivotColumnSplit extends PivotColumnSplit { 24 | StringPivotColumnSplit(DataModelObject dataModelObject, String field) { 25 | super(dataModelObject, field); 26 | } 27 | 28 | @Override 29 | JsonObject toJson() { 30 | JsonObject root = new JsonObject(); 31 | 32 | addCommonFields(root); 33 | 34 | return root; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/StringArrayPropertyEditor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import java.beans.PropertyEditorSupport; 20 | import java.util.Arrays; 21 | 22 | public class StringArrayPropertyEditor extends PropertyEditorSupport { 23 | @Override public String getAsText() { 24 | String[] value = (String[])getValue(); 25 | if (value == null) return "null"; 26 | return Arrays.toString(value); 27 | } 28 | 29 | @Override public void setAsText(String value) { 30 | throw new UnsupportedOperationException(); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/NumericPivotColumnSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonObject; 19 | import com.google.gson.JsonPrimitive; 20 | 21 | public class NumericPivotColumnSplit extends PivotColumnSplit { 22 | NumericPivotColumnSplit(DataModelObject dataModelObject, String field) { 23 | super(dataModelObject, field); 24 | } 25 | 26 | @Override 27 | JsonObject toJson() { 28 | JsonObject root = new JsonObject(); 29 | 30 | addCommonFields(root); 31 | root.add("display", new JsonPrimitive("all")); 32 | 33 | return root; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/StringPivotRowSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonElement; 19 | import com.google.gson.JsonObject; 20 | 21 | /** 22 | * Represents a row split on a string valued field. 23 | */ 24 | public class StringPivotRowSplit extends PivotRowSplit { 25 | StringPivotRowSplit(DataModelObject dataModelObject, String field, String label) { 26 | super(dataModelObject, field, label); 27 | } 28 | 29 | @Override 30 | JsonElement toJson() { 31 | JsonObject root = new JsonObject(); 32 | addCommonFields(root); 33 | return root; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | on: 2 | release: 3 | types: [published] 4 | 5 | permissions: 6 | contents: write 7 | 8 | name: Release 9 | 10 | jobs: 11 | build: 12 | name: Java SDK Release 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up JDK 1.8 17 | uses: actions/setup-java@v1 18 | with: 19 | java-version: 1.8 20 | server-username: MAVEN_USERNAME 21 | server-password: MAVEN_PASSWORD 22 | server-id: splunk-artifactory 23 | - name: build 24 | run: mvn package --file pom.xml -DskipTests=true 25 | - name: Create GitHub Release 26 | uses: softprops/action-gh-release@v1 27 | with: 28 | files: ./splunk/target/*.jar 29 | draft: true 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | - name: Deploy to Artifactory 33 | run: mvn --batch-mode deploy -DskipTests=true 34 | env: 35 | MAVEN_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} 36 | MAVEN_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} 37 | 38 | - name: Upload Artifact 39 | uses: actions/upload-artifact@v3 40 | with: 41 | name: java_sdk_docs 42 | path: splunk/target/apidocs 43 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/Program.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Service; 20 | import com.splunk.Command; 21 | 22 | import javax.swing.SwingUtilities; 23 | 24 | public class Program { 25 | public static void main(final String[] args) { 26 | SwingUtilities.invokeLater(new Runnable() { 27 | public void run() { 28 | Command command = Command.splunk("explorer").parse(args); 29 | Service service = Service.connect(command.opts); 30 | Explorer.create(service).setVisible(true); 31 | } 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/StatsFunction.java: -------------------------------------------------------------------------------- 1 | package com.splunk; 2 | 3 | public enum StatsFunction { 4 | LIST { 5 | public String toString() { return "list"; } 6 | }, 7 | DISTINCT_VALUES { 8 | public String toString() { return "values"; } 9 | }, 10 | FIRST { 11 | public String toString() { return "first"; } 12 | }, 13 | LAST { 14 | public String toString() { return "last"; } 15 | }, 16 | COUNT { 17 | public String toString() { return "count"; } 18 | }, 19 | DISTINCT_COUNT { 20 | public String toString() { return "dc"; } 21 | }, 22 | SUM { 23 | public String toString() { return "sum"; } 24 | }, 25 | AVERAGE { 26 | public String toString() { return "average"; } 27 | }, 28 | MAX { 29 | public String toString() { return "max"; } 30 | }, 31 | MIN { 32 | public String toString() { return "min"; } 33 | }, 34 | STDEV { 35 | public String toString() { return "stdev"; } 36 | }, 37 | DURATION { 38 | public String toString() { return "duration"; } 39 | }, 40 | EARLIEST { 41 | public String toString() { return "earliest"; } 42 | }, 43 | LATEST { 44 | public String toString() { return "latest"; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /launchers/shim/shim.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shim", "shim\shim.vcxproj", "{830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Debug|Win32.ActiveCfg = Debug|x64 15 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Debug|Win32.Build.0 = Debug|x64 16 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Debug|x64.ActiveCfg = Debug|x64 17 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Debug|x64.Build.0 = Debug|x64 18 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Release|Win32.ActiveCfg = Release|Win32 19 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Release|Win32.Build.0 = Release|Win32 20 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Release|x64.ActiveCfg = Release|x64 21 | {830BB6EA-1A0C-4BFB-BD9B-E36F39ABF21C}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/PasswordNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class PasswordNode extends EntityNode { 22 | PasswordNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getClearPassword"); 29 | list.add(String.class, "getEncryptedPassword"); 30 | list.add(String.class, "getPassword"); 31 | list.add(String.class, "getRealm"); 32 | list.add(String.class, "getUsername"); 33 | return list; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/BaseService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * Contains functionality common to Splunk Enterprise and Splunk Storm. 21 | * 22 | * This class is an implementation detail and is therefore SDK-private. 23 | */ 24 | abstract class BaseService extends HttpService { 25 | protected BaseService() { 26 | super(); 27 | } 28 | 29 | protected BaseService(String host) { 30 | super(host); 31 | } 32 | 33 | protected BaseService(String host, int port) { 34 | super(host, port); 35 | } 36 | 37 | protected BaseService(String host, int port, String scheme) { 38 | super(host, port, scheme); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/UdpConnections.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | /** 19 | * The {@code UdpConnections} class represents a UDP connection. 20 | */ 21 | public class UdpConnections extends Entity { 22 | 23 | /** 24 | * Class constructor. 25 | * 26 | * @param service The connected {@code Service} instance. 27 | * @param path The UPD input endpoint. 28 | */ 29 | UdpConnections(Service service, String path) { 30 | super(service, path); 31 | } 32 | 33 | /** 34 | * Return the server name. 35 | * 36 | * @return The server name. 37 | */ 38 | public String getGroup() { 39 | return getString("group", null); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /launchers/shim-darwin.sh: -------------------------------------------------------------------------------- 1 | # Shim to run a modular input written in Java. The modular input 2 | # is assumed to be in the form of an executable jar. This shim 3 | # is in ${PLATFORM}/bin/${INPUTNAME}.sh of the app the modular 4 | # input is contained in, and the jar is assumed to be in 5 | # jars/${INPUTNAME}.jar in the app. 6 | # 7 | # If ${PLATFORM}/bin/customized.java.path exists, this script will 8 | # use java cmd defined in this file to start jvm, else default java 9 | # will be used. 10 | # 11 | # Extra arguments to the JVM (i.e., -Xms512M) can be put in 12 | # a file jars/${INPUTNAME}.vmopts and will be interpolated 13 | # into the command to run the JVM. 14 | SCRIPT="$0" 15 | 16 | cd `dirname "$SCRIPT"` 17 | SCRIPT=`basename "$SCRIPT"` 18 | 19 | while [ -L "$SCRIPT" ]; do 20 | SCRIPT=`readlink "$SCRIPT"` 21 | cd `dirname "$SCRIPT"` 22 | SCRIPT=`basename "$SCRIPT"` 23 | done 24 | 25 | BASENAME=$(basename "$SCRIPT" .sh) 26 | JAR_DIR=`pwd -P`/../../jars 27 | CUSTOMIZED_JAVA_PATH_FILE=`pwd -P`/customized.java.path 28 | 29 | if [ -f $CUSTOMIZED_JAVA_PATH_FILE ]; then 30 | JAVA_CMD=`cat $CUSTOMIZED_JAVA_PATH_FILE` 31 | else 32 | JAVA_CMD="java" 33 | fi 34 | 35 | if [ -f $JAR_DIR/$BASENAME.vmopts ]; then 36 | VMOPTS=`cat $JAR_DIR/$BASENAME.vmopts` 37 | else 38 | VMOPTS="" 39 | fi 40 | 41 | exec $JAVA_CMD $VMOPTS -jar $JAR_DIR/$BASENAME.jar $@ 42 | 43 | -------------------------------------------------------------------------------- /launchers/shim/shim/shim.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SPLUNKD_PROCESSID=1416 5 | $(LocalDebuggerEnvironment) 6 | WindowsLocalDebugger 7 | 8 | 9 | SPLUNKD_PROCESSID=1416$(LocalDebuggerEnvironment) 10 | WindowsLocalDebugger 11 | 12 | 13 | 14 | 15 | --scheme 16 | SPLUNKD_PROCESSID=1416 17 | WindowsLocalDebugger 18 | 19 | 20 | SPLUNKD_PROCESSID=1416 21 | WindowsLocalDebugger 22 | 23 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/LicensePoolNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class LicensePoolNode extends EntityNode { 22 | LicensePoolNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getDescriptionLabel"); 29 | list.add(long.class, "getQuota"); 30 | list.add(String[].class, "getSlaves"); 31 | list.add(long.class, "getSlavesUsageBytes"); 32 | list.add(String.class, "getStackId"); 33 | list.add(long.class, "getUsedBytes"); 34 | return list; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/ResourceNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Resource; 20 | 21 | import org.openide.nodes.Children; 22 | 23 | class ResourceNode extends ExplorerNode { 24 | ResourceNode(Resource value) { 25 | super(value); 26 | setDisplayName(value.getName()); 27 | } 28 | 29 | ResourceNode(Resource value, Children kids) { 30 | super(value, kids); 31 | setDisplayName(value.getName()); 32 | } 33 | 34 | @Override protected PropertyList getMetadata() { 35 | return new PropertyList() {{ 36 | add(String.class, "getPath"); 37 | add(String.class, "getTitle"); 38 | }}; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/SplunkException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * Thrown for Splunk responses that return an error status code. 21 | */ 22 | public class SplunkException extends RuntimeException { 23 | private int code; 24 | private String text; 25 | 26 | public static final int JOB_NOTREADY = 1; 27 | public static final int TIMEOUT = 2; 28 | public static final int AMBIGUOUS = 3; 29 | public static final int INTERRUPTED = 4; 30 | 31 | SplunkException(int code, String text) { 32 | super(text); 33 | this.code = code; 34 | this.text = text; 35 | } 36 | 37 | public int getCode() { 38 | return code; 39 | } 40 | 41 | public String getText() { 42 | return text; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /.idea/projectCodeStyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/TimestampBinning.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | /** 19 | * Possible bin sizes for timestamp valued fields in pivots. 20 | */ 21 | public enum TimestampBinning { 22 | AUTO { 23 | public String toString() { return "auto"; } 24 | }, 25 | YEAR { 26 | public String toString() { return "year"; } 27 | }, 28 | MONTH { 29 | public String toString() { return "month"; } 30 | }, 31 | DAY { 32 | public String toString() { return "day"; } 33 | }, 34 | HOUR { 35 | public String toString() { return "hour"; } 36 | }, 37 | MINUTE { 38 | public String toString() { return "minute"; } 39 | }, 40 | SECOND { 41 | public String toString() { return "second"; } 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/ConfCollectionNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.ConfCollection; 20 | 21 | // UNDONE: Some duplication of EntityConnectionNode below, eg: title count 22 | // and size property - could probably be refactored into a shared 23 | // CollectionNode base class. 24 | class ConfCollectionNode extends ResourceNode { 25 | ConfCollectionNode(ConfCollection value) { 26 | super(value, new ConfCollectionKids(value)); 27 | setDisplayName(String.format("Configuration (%d)", value.size())); 28 | } 29 | 30 | @Override protected PropertyList getMetadata() { 31 | PropertyList list = super.getMetadata(); 32 | list.add(int.class, "size"); 33 | return list; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/info/Program.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.info; 18 | 19 | import com.splunk.*; 20 | 21 | public class Program { 22 | public static void main(String[] args) { 23 | Command command = Command.splunk("info").parse(args); 24 | Service service = Service.connect(command.opts); 25 | 26 | ServiceInfo info = service.getInfo(); 27 | System.out.println("Info:"); 28 | for (String key : info.keySet()) 29 | System.out.println(" " + key + ": " + info.get(key)); 30 | 31 | Entity settings = service.getSettings(); 32 | System.out.println("\nSettings:"); 33 | for (String key : settings.keySet()) 34 | System.out.println(" " + key + ": " + settings.get(key)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/NumberPivotRowSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonElement; 19 | import com.google.gson.JsonObject; 20 | import com.google.gson.JsonPrimitive; 21 | 22 | /** 23 | * Specifies a row split in a pivot on a numeric field. 24 | * 25 | * Each value of the field will be split into a different row. 26 | */ 27 | public class NumberPivotRowSplit extends PivotRowSplit { 28 | NumberPivotRowSplit(DataModelObject owner, String field, String label) { 29 | super(owner, field, label); 30 | } 31 | 32 | @Override 33 | JsonElement toJson() { 34 | JsonObject root = new JsonObject(); 35 | 36 | addCommonFields(root); 37 | root.add("display", new JsonPrimitive("all")); 38 | 39 | return root; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/modularinput/NonblockingInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.modularinput; 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * The {@code NonblockingInputStream} class is a stream wrapper that acts as though 24 | * the underlying stream has terminated every time it blocks. 25 | */ 26 | public class NonblockingInputStream extends InputStream { 27 | private final InputStream stream; 28 | 29 | public NonblockingInputStream(InputStream stream) { 30 | this.stream = stream; 31 | } 32 | 33 | @Override 34 | public int read() throws IOException { 35 | if (stream.available() != 0) { 36 | return stream.read(); 37 | } else { 38 | return -1; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/UserNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class UserNode extends EntityNode { 22 | UserNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String.class, "getDefaultApp"); 29 | list.add(boolean.class, "getDefaultAppIsUserOverride"); 30 | list.add(String.class, "getDefaultAppSourceRole"); 31 | list.add(String.class, "getEmail"); 32 | list.add(String.class, "getPassword"); 33 | list.add(String.class, "getRealName"); 34 | list.add(String[].class, "getRoles"); 35 | return list; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /argsGenerator/specs/JobResultsPreviewArgs__GET_search_jobs_NAME_results_preview.argspec: -------------------------------------------------------------------------------- 1 | # TODO: Improve docs: Formatting of the description differs from that of 2 | # GET search/jobs/{search_id}/results_preview. Otherwise all other parameters are identical. 3 | count 4 | Count 5 | int 6 | Sets the maximum number of results to return. 7 | - 8 | The maximum number of results. To return all available results, specify 0. 9 | === 10 | # TODO: Improve docs: Why isn't "field_list" deprecated when there is "f" present? 11 | f 12 | FieldList 13 | String[]-MULTIPLE 14 | Sets a list of fields to return for the event set. 15 | - 16 | A list of fields. 17 | === 18 | offset 19 | Offset 20 | int 21 | Specifies the index of the first result (inclusive) from which to begin returning data. This value is 0-indexed.

In Splunk 4.1+, negative offsets are allowed and are added to the count to compute the absolute offset (for example, offset=-1 is the last available offset). Offsets in the results are always absolute and never negative. The default value is 0. 22 | - 23 | The index of the first result to return. 24 | === 25 | # TODO: Improve docs: The referenced document does not actually document the enum constants. 26 | output_mode 27 | OutputMode 28 | OutputMode 29 | Sets the format of the output. 30 | - 31 | The output format. 32 | === 33 | search 34 | Search 35 | String 36 | Sets the post-processing search to apply to results. 37 | - 38 | The post-processing search query. 39 | === 40 | -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | # Third-party software credits 2 | 3 | Some of the components included in the Splunk Enterprise SDK for Java are licensed under free or open source licenses. We wish to thank the contributors to those projects. 4 | 5 | | Contributor | Description | License | 6 | |:----------- |:----------- |:------- | 7 | | [opencsv](https://sourceforge.net/p/opencsv/source/ci/master/tree/) | For reading and writing CSV in Java | [Apache](https://github.com/splunk/splunk-sdk-java/blob/master/licenses/LICENSE-OPENCSV) | 8 | | [commons-cli](https://github.com/apache/commons-cli) | A package of Java utility classes for the classes that are in java.lang's hierarchy | [Apache](https://github.com/splunk/splunk-sdk-java/blob/master/licenses/LICENSE-COMMONS) | 9 | | [gson](https://github.com/google/gson) | Convert Java Objects into their JSON representation | [Apache](https://github.com/splunk/splunk-sdk-java/blob/master/licenses/LICENSE-GSON) | 10 | | [junit](https://github.com/junit-team/junit4) | Unit testing framework for Java | [Eclipse](https://github.com/splunk/splunk-sdk-java/blob/master/licenses/LICENSE-JUNIT) | 11 | | [jacoco](https://github.com/jacoco/jacoco) | JaCoCo runtime agent to your tests and allows basic report creation. | [Eclipse](https://github.com/splunk/splunk-sdk-java/blob/master/licenses/LICENSE-JACOCO) | 12 | | [netbeans-api](https://github.com/apache/netbeans) | OpenIDE Utilities | [Apache](https://github.com/splunk/splunk-sdk-java/blob/master/licenses/LICENSE-NETBEANS) | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/EntityKids.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | import com.splunk.EntityMetadata; 21 | 22 | import org.openide.nodes.Children; 23 | import org.openide.nodes.Node; 24 | 25 | class EntityKids extends Children.Keys { 26 | Entity entity; 27 | 28 | EntityKids(Entity entity) { 29 | this.entity = entity; 30 | } 31 | 32 | @Override protected void addNotify() { 33 | EntityMetadata metadata = entity.getMetadata(); 34 | if (metadata == null) return; 35 | setKeys(new EntityMetadata[] { metadata }); 36 | } 37 | 38 | @Override protected Node[] createNodes(EntityMetadata metadata) { 39 | return new Node[] { new EntityMetadataNode(metadata) }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/SearchResults.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.util.Collection; 20 | 21 | /** 22 | * The {@code SearchResults} interface represents Splunk search results. 23 | */ 24 | public interface SearchResults extends Iterable { 25 | /** 26 | * Indicates whether the results are a preview from an unfinished search. 27 | * @return {@code true} if the results are a preview, {@code false} if not. 28 | */ 29 | public boolean isPreview(); 30 | 31 | /** 32 | * Returns a collection of field names from the results. 33 | * @return A collection of field names. 34 | *

35 | * Note that any given result will contain a subset of these fields. 36 | */ 37 | public Collection getFields(); 38 | } 39 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/TimestampPivotColumnSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonObject; 19 | 20 | /** 21 | * Represents a column split on a timestamp valued field in a pivot. 22 | */ 23 | public class TimestampPivotColumnSplit extends PivotColumnSplit { 24 | private final TimestampBinning binning; 25 | 26 | TimestampPivotColumnSplit(DataModelObject owner, String fieldName, TimestampBinning binning) { 27 | super(owner, fieldName); 28 | this.binning = binning; 29 | } 30 | 31 | public TimestampBinning getBinning() { return this.binning; } 32 | 33 | @Override 34 | JsonObject toJson() { 35 | JsonObject root = new JsonObject(); 36 | addCommonFields(root); 37 | root.addProperty("period", binning.toString()); 38 | return root; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/IPv4Comparison.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | /** 19 | * Comparison operators that apply to IPv4 values in data models and pivots. 20 | */ 21 | public enum IPv4Comparison { 22 | IS { 23 | public String toString() { return "is"; } 24 | }, 25 | CONTAINS { 26 | public String toString() { return "contains"; } 27 | }, 28 | IS_NOT { 29 | public String toString() { return "isNot"; } 30 | }, 31 | DOES_NOT_CONTAIN { 32 | public String toString() { return "doesNotContain"; } 33 | }, 34 | STARTS_WITH { 35 | public String toString() { return "startsWith"; } 36 | }, 37 | IS_NULL { 38 | public String toString() { return "isNull"; } 39 | }, 40 | IS_NOT_NULL { 41 | public String toString() { return "isNotNull"; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /splunk/src/test/resources/results.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | series 6 | sum(kb) 7 | 8 | 9 | 10 | base lispy: [ AND ] 11 | search context: user='admin', app='search', bs-pathname='/some/path' 12 | 13 | 14 | 15 | twitter 16 | 17 | 18 | 14372242.758775 19 | 20 | 21 | 22 | 23 | splunkd 24 | 25 | 26 | 267802.333926 27 | 28 | 29 | 30 | 31 | flurry 32 | 33 | 34 | 12576.454102 35 | 36 | 37 | 38 | 39 | splunkd_access 40 | 41 | 42 | 5979.036338 43 | 44 | 45 | 46 | 47 | splunk_web_access 48 | 49 | 50 | 5838.935649 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/ExplorerNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import org.openide.nodes.AbstractNode; 20 | import org.openide.nodes.Children; 21 | import org.openide.nodes.Sheet; 22 | 23 | // Abstract node that simplifies the creation of node metadata. 24 | class ExplorerNode extends AbstractNode { 25 | Object value; 26 | 27 | ExplorerNode(Object value) { 28 | super(Children.LEAF); 29 | this.value = value; 30 | } 31 | 32 | ExplorerNode(Object value, Children kids) { 33 | super(kids); 34 | this.value = value; 35 | } 36 | 37 | protected PropertyList getMetadata() { 38 | return new PropertyList(); 39 | } 40 | 41 | @Override protected Sheet createSheet() { 42 | return getMetadata().createSheet(value); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/results/results.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | series 6 | sum(kb) 7 | 8 | 9 | 10 | base lispy: [ AND ] 11 | search context: user='admin', app='search', bs-pathname='/some/path' 12 | 13 | 14 | 15 | twitter 16 | 17 | 18 | 14372242.758775 19 | 20 | 21 | 22 | 23 | splunkd 24 | 25 | 26 | 267802.333926 27 | 28 | 29 | 30 | 31 | flurry 32 | 33 | 34 | 12576.454102 35 | 36 | 37 | 38 | 39 | splunkd_access 40 | 41 | 42 | 5979.036338 43 | 44 | 45 | 46 | 47 | splunk_web_access 48 | 49 | 50 | 5838.935649 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/DataModelSearch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | /** 19 | * DataModelSearch represents a data model object that directly wraps a Splunk search query. 20 | * 21 | * It appears only as a direct subobject of the BaseSearch built-in type. All its children 22 | * appear as normal DataModelObject instances. DataModelSearch objects have one additional 23 | * getter, getBaseSearch, which returns the underlying search which this object 24 | * wraps. 25 | */ 26 | public class DataModelSearch extends DataModelObject { 27 | protected String baseSearch; 28 | 29 | DataModelSearch(DataModel model) { 30 | super(model); 31 | } 32 | 33 | /** 34 | * @return the search query wrapped by this data model object. 35 | */ 36 | public String getBaseSearch() { 37 | return baseSearch; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/EvalDataModelCalculation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * Represents a calculation on a data model object done by an eval. 22 | */ 23 | public class EvalDataModelCalculation extends DataModelCalculation { 24 | private final String expression; 25 | 26 | public EvalDataModelCalculation(String[] owner, String calculationID, 27 | Map generatedFields, String comment, 28 | boolean editable, String expression) { 29 | super(owner, calculationID, generatedFields, comment, editable); 30 | this.expression = expression; 31 | } 32 | 33 | /** 34 | * @return eval expression specifying this calculation 35 | */ 36 | public String getExpression() { return this.expression; } 37 | } 38 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/NumberComparison.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | /** 19 | * Comparison operators on numeric fields. 20 | */ 21 | public enum NumberComparison { 22 | EQUALS { 23 | public String toString() { return "="; } 24 | }, 25 | NOT_EQUALS { 26 | public String toString() { return "!="; } 27 | }, 28 | LESS_THAN { 29 | public String toString() { return "<"; } 30 | }, 31 | AT_MOST { 32 | public String toString() { return "<="; } 33 | }, 34 | GREATHER_THAN { 35 | public String toString() { return ">"; } 36 | }, 37 | AT_LEAST { 38 | public String toString() { return ">="; } 39 | }, 40 | IS_NULL { 41 | public String toString() { return "isNull"; } 42 | }, 43 | IS_NOT_NULL { 44 | public String toString() { return "isNotNull"; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/BooleanPivotColumnSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonObject; 19 | 20 | /** 21 | * Represents a column split on a boolean valued field in a pivot. 22 | */ 23 | public class BooleanPivotColumnSplit extends PivotColumnSplit { 24 | private final String trueLabel, falseLabel; 25 | 26 | BooleanPivotColumnSplit(DataModelObject owner, String fieldName, String trueLabel, String falseLabel) { 27 | super(owner, fieldName); 28 | this.trueLabel = trueLabel; 29 | this.falseLabel = falseLabel; 30 | } 31 | 32 | @Override 33 | JsonObject toJson() { 34 | JsonObject root = new JsonObject(); 35 | addCommonFields(root); 36 | 37 | root.addProperty("trueLabel", trueLabel); 38 | root.addProperty("falseLabel", falseLabel); 39 | 40 | return root; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/FiredAlertGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | /** 19 | * The {@code FiredAlertGroup} class represents a group of fired alerts, which 20 | * are the alerts for a given saved search. 21 | */ 22 | public class FiredAlertGroup extends Entity { 23 | 24 | /** 25 | * Class constructor. 26 | * 27 | * @param service The connected {@code Service} instance. 28 | * @param path The fired alert endpoint. 29 | */ 30 | FiredAlertGroup(Service service, String path) { 31 | super(service, path); 32 | } 33 | 34 | /** 35 | * Returns a group of fired alerts for a given saved search. 36 | * 37 | * @return The fired alerts in the group. 38 | */ 39 | public EntityCollection getAlerts() { 40 | return new EntityCollection( 41 | service, this.path, FiredAlert.class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /deploy.md: -------------------------------------------------------------------------------- 1 | ##NAME 2 | 3 | deploy - Transmit splunk-sdk-java artifacts to the local, staging or production 4 | maven artifact repository 5 | 6 | ##SYNOPSIS 7 | 8 | deploy \ 9 | 10 | ##DESCRIPTION 11 | 12 | Deploy transmits **target/splunk-1.9.5.jar**, **target/splunk-1.9.5-javadoc.jar**, and 13 | **target/splunk-1.9.5-sources.jar** to the **local**, **staging**, or **production** 14 | maven repository. Repository names are mapped to locations as follows. 15 | 16 | | repository-name | location | 17 | |-----------------|----------------------------------------------------------------| 18 | | local | file:///${HOME}/.m2/repository/ | 19 | | staging | http://stg-artifactory:8081/artifactory/devplat-staging/ | | 20 | | production | https://splunk.jfrog.io/artifactory/ext-releases-local/ | 21 | 22 | After deployment you should find this tree structure at the location of your repository 23 | 24 | com/splunk/splunk/1.9.5/ 25 | ├── splunk-1.9.5-javadoc.jar 26 | ├── splunk-1.9.5-javadoc.jar.md5 27 | ├── splunk-1.9.5-javadoc.jar.sha1 28 | ├── splunk-1.9.5-sources.jar 29 | ├── splunk-1.9.5-sources.jar.md5 30 | ├── splunk-1.9.5-sources.jar.sha1 31 | ├── splunk-1.9.5.jar 32 | ├── splunk-1.9.5.jar.md5 33 | ├── splunk-1.9.5.jar.sha1 34 | ├── splunk-1.9.5.pom 35 | ├── splunk-1.9.5.pom.md5 36 | └── splunk-1.9.5.pom.sha1 37 | 38 | Verify this structure prior to release. 39 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/GeoIPDataModelCalculation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * Represents a GeoIP lookup on a data model object, which uses an input 22 | * field to add geographic information to the output. 23 | */ 24 | 25 | public class GeoIPDataModelCalculation extends DataModelCalculation { 26 | private final String inputField; 27 | 28 | GeoIPDataModelCalculation(String[] ownerLineage, String calculationID, 29 | Map generatedFields, String comment, 30 | boolean editable, String inputField) { 31 | super(ownerLineage, calculationID, generatedFields, comment, editable); 32 | this.inputField = inputField; 33 | } 34 | 35 | /** 36 | * @return field to do GeoIP lookup on 37 | */ 38 | public String getInputField() { return this.inputField; } 39 | } 40 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/UploadTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import org.junit.Test; 20 | 21 | import java.io.File; 22 | import java.io.FileWriter; 23 | import java.io.IOException; 24 | import java.util.Date; 25 | 26 | public class UploadTest extends SDKTestCase { 27 | @Test 28 | public void testOneshot() { 29 | String filename = locateSystemLog(); 30 | if (System.getenv("SPLUNK_HOME") != null) { 31 | filename = System.getenv("SPLUNK_HOME") + "/copyright.txt"; 32 | } 33 | 34 | service.getUploads().create(filename); 35 | 36 | for (Upload oneshot : service.getUploads().values()) { 37 | oneshot.getBytesIndexed(); 38 | oneshot.getOffset(); 39 | oneshot.getSize(); 40 | oneshot.getSize(); 41 | oneshot.getSourcesIndexed(); 42 | oneshot.getSpoolTime(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/ConfCollectionKids.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.ConfCollection; 20 | import com.splunk.Entity; 21 | import com.splunk.EntityCollection; 22 | 23 | import java.util.Collection; 24 | import org.openide.nodes.Children; 25 | import org.openide.nodes.Node; 26 | 27 | class ConfCollectionKids extends Children.Keys { 28 | ConfCollection confs; 29 | 30 | ConfCollectionKids(ConfCollection confs) { 31 | this.confs = confs; 32 | } 33 | 34 | @Override protected void addNotify() { 35 | Collection> values = confs.values(); 36 | setKeys(values); 37 | } 38 | 39 | @Override protected Node[] createNodes(EntityCollection conf) { 40 | return new Node[] { 41 | new EntityCollectionNode(conf.getTitle(), conf, StanzaNode.class) 42 | }; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /launchers/shim/shim/shim.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/PivotColumnSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonObject; 19 | 20 | public abstract class PivotColumnSplit { 21 | private final String fieldName; 22 | private final DataModelObject owner; 23 | 24 | PivotColumnSplit(DataModelObject owner, String fieldName) { 25 | this.fieldName = fieldName; 26 | this.owner = owner; 27 | } 28 | 29 | public String getFieldName() { return this.fieldName; } 30 | 31 | public DataModelObject getOwner() { return this.owner; } 32 | 33 | protected void addCommonFields(JsonObject obj) { 34 | DataModelField field = this.owner.getField(this.fieldName); 35 | 36 | obj.addProperty("fieldName", this.fieldName); 37 | obj.addProperty("owner", Util.join(".", field.getOwnerLineage())); 38 | obj.addProperty("type", field.getType().toString()); 39 | } 40 | 41 | abstract JsonObject toJson(); 42 | } 43 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/TcpConnections.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | /** 19 | * The {@code TcpConnections} class represents a raw or cooked TCP connection. 20 | */ 21 | public class TcpConnections extends Entity { 22 | 23 | /** 24 | * Class constructor. 25 | * 26 | * @param service The connected {@code Service} instance. 27 | * @param path The TCP input endpoint. 28 | */ 29 | TcpConnections(Service service, String path) { 30 | super(service, path); 31 | } 32 | 33 | /** 34 | * Returns the TCP connection. 35 | * 36 | * @return The TCP connection. 37 | */ 38 | public String getConnection() { 39 | return getString("connection", null); 40 | } 41 | 42 | /** 43 | * Returns the server name. 44 | * 45 | * @return The server name. 46 | */ 47 | public String getServername() { 48 | return getString("servername", null); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/splunk.license: -------------------------------------------------------------------------------- 1 | 2 | 3 | MF5kKJJZo5PFE9A8YIxMo5L+7kIHzFkGMweNLaLXbiNI2OdP9ZazXDcC8/ioswEVXA2IWj14q6TKK9gQB+2VO5TakyFF45QgaWGJwuGtq6hYVIPiwMSY7SnlHFys30nzE7cQ0V1EwMDL03pMvM3YzbvbpNHcm92riGoAtj01QMbBm1KE/oxdR+XiYnFqFNNlUMVLwtygarUdaJNmy15lOTQdHsvW7Cf3F7gKb12NPUi3xBg1PApsc3O3pfQYsFTzXrJC+Fwfrx5P/0ha+bwrSN3idmGiIg1FiPVoTIiQdxyRTFhKYV6ly2eDPSxj4TnAwnp8HDBNNqHOZ9LYpRF/kA== 4 | 5 | enterprise 6 | Enterprise 7 | 1048576 8 | 5 9 | 30 10 | 1321914737 11 | 12 | 9961828337 13 | 14 | Auth 15 | FwdData 16 | RcvData 17 | LocalSearch 18 | DistSearch 19 | RcvSearch 20 | ScheduledSearch 21 | Alerting 22 | DeployClient 23 | DeployServer 24 | SplunkWeb 25 | SigningProcessor 26 | SyslogOutputProcessor 27 | AllowDuplicateKeys 28 | CanBeRemoteMaster 29 | 30 | 31 | AD1D800A-04CC-4ED2-9754-85335ECEA6E3 32 | 33 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/TimestampPivotRowSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonElement; 19 | import com.google.gson.JsonObject; 20 | 21 | /** 22 | * Represents a row split on a timestamp valued field in a pivot. 23 | */ 24 | public class TimestampPivotRowSplit extends PivotRowSplit { 25 | private final TimestampBinning binning; 26 | 27 | TimestampPivotRowSplit(DataModelObject dataModelObject, String field, 28 | String label, TimestampBinning binning) { 29 | super(dataModelObject, field, label); 30 | 31 | this.binning = binning; 32 | } 33 | 34 | public TimestampBinning getBinning() { return this.binning; } 35 | 36 | @Override 37 | JsonElement toJson() { 38 | JsonObject root = new JsonObject(); 39 | 40 | addCommonFields(root); 41 | 42 | root.addProperty("period", this.binning.toString()); 43 | 44 | return root; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/AppNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Application; 20 | import com.splunk.Entity; 21 | 22 | class AppNode extends EntityNode { 23 | public AppNode(Entity value) { 24 | super(value); 25 | Application app = (Application)value; 26 | String displayName = app.getLabel(); 27 | if (displayName == null) displayName = app.getName(); 28 | setDisplayName(displayName); 29 | } 30 | 31 | @Override protected PropertyList getMetadata() { 32 | PropertyList list = super.getMetadata(); 33 | list.add(boolean.class, "getCheckForUpdates"); 34 | list.add(String.class, "getLabel"); 35 | list.add(String.class, "getVersion"); 36 | list.add(boolean.class, "isConfigured"); 37 | list.add(boolean.class, "isManageable"); 38 | list.add(boolean.class, "isVisible"); 39 | return list; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/DatePropertyEditor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import java.beans.PropertyEditorSupport; 20 | import java.text.ParseException; 21 | import java.text.SimpleDateFormat; 22 | import java.util.Date; 23 | 24 | public class DatePropertyEditor extends PropertyEditorSupport { 25 | static String datePattern = "MM/dd/yyyy HH:mm:ss"; 26 | static SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern); 27 | 28 | @Override public String getAsText() { 29 | Date value = (Date)getValue(); 30 | if (value == null) return "null"; 31 | return dateFormat.format(value); 32 | } 33 | 34 | @Override public void setAsText(String value) { 35 | try { 36 | setValue(dateFormat.parse(value)); 37 | } 38 | catch (ParseException e) { 39 | throw new IllegalArgumentException("Invalid date format"); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/splunk_at_least_cupcake.license: -------------------------------------------------------------------------------- 1 | 2 | 3 | dTEDyZNMuiTE7Nu1Y3ZUr8l9pbGaX/RRo/eAhsGBHuo23VyYzaiyHnPHyr8IPL7d3opT/4EBfrCNI4HGwN1EOdiES9mt91fDQvEFx8f+p+RJnlFJfRQqbbWZWWjqxfJvYIlBc9GDiZ0xSo+Bc+DuYdlkG4f+WywHIH/k9HN6snqCxVojRJwiJAGjDn5FmUVIcaKCF84MaRVFPmRlicNzQ6pYvQjimPaUHNoP5NB9rgWg4ehaZ+bfR2AcjpgSBNiJOwKRI9EdNLA7GPXphcujyKynl45RSWZmqd5vQMHIH4a2BTeK+0QwPoJni4CUtN19yUFUNOiXHjx6Aunjw9qVtA== 4 | 5 | enterprise 6 | Enterprise 7 | 104857600 8 | 5 9 | 30 10 | 1397458800 11 | 12 | 1397804400 13 | 14 | Auth 15 | FwdData 16 | RcvData 17 | LocalSearch 18 | DistSearch 19 | RcvSearch 20 | ScheduledSearch 21 | Alerting 22 | DeployClient 23 | DeployServer 24 | SplunkWeb 25 | SigningProcessor 26 | SyslogOutputProcessor 27 | AllowDuplicateKeys 28 | CanBeRemoteMaster 29 | 30 | 31 | C759B91D-3D25-438F-95CA-092C512DFBEC 32 | 33 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/DistributedPeerNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class DistributedPeerNode extends EntityNode { 22 | DistributedPeerNode(Entity value) { 23 | super(value); 24 | } 25 | 26 | @Override protected PropertyList getMetadata() { 27 | PropertyList list = super.getMetadata(); 28 | list.add(String[].class, "getBundleVersions"); 29 | list.add(String.class, "getGuid"); 30 | list.add(String.class, "getLicenseSignature"); 31 | list.add(String.class, "getPeerName"); 32 | list.add(String.class, "getPeerType"); 33 | list.add(String.class, "getReplicationStatus"); 34 | list.add(String.class, "getStatus"); 35 | list.add(String.class, "getVersion"); 36 | list.add(boolean.class, "isDisabled"); 37 | list.add(boolean.class, "isHttps"); 38 | return list; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/StringComparison.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | /** 19 | * Comparison operators for string valued fields. 20 | */ 21 | public enum StringComparison { 22 | IS { 23 | public String toString() { return "is"; } 24 | }, 25 | CONTAINS { 26 | public String toString() { return "contains"; } 27 | }, 28 | IS_NOT { 29 | public String toString() { return "isNot"; } 30 | }, 31 | DOES_NOT_CONTAIN { 32 | public String toString() { return "doesNotContain"; } 33 | }, 34 | STARTS_WITH { 35 | public String toString() { return "startsWith"; } 36 | }, 37 | ENDS_WITH { 38 | public String toString() { return "endsWith"; } 39 | }, 40 | IS_NULL { 41 | public String toString() { return "isNull"; } 42 | }, 43 | IS_NOT_NULL { 44 | public String toString() { return "isNotNull"; } 45 | }, 46 | REGEX { 47 | public String toString() { return "regex"; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/LicenseGroupTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | import org.junit.Assert; 23 | import org.junit.Test; 24 | 25 | public class LicenseGroupTest extends SDKTestCase { 26 | // list of stackids, empirically created 27 | private static final List KNOWN_STACK_IDS = Arrays.asList( 28 | "download-trial", 29 | "enterprise", 30 | "forwarder", 31 | "free", 32 | "trial", 33 | ""); 34 | 35 | @Test 36 | public void testLicenseGroup() throws Exception { 37 | for (LicenseGroup licenseGroup: service.getLicenseGroups().values()) { 38 | // Recognized stack ID? 39 | for (String id: licenseGroup.getStackIds()) { 40 | Assert.assertTrue(KNOWN_STACK_IDS.contains(id)); 41 | } 42 | 43 | // Test getters 44 | licenseGroup.isActive(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /argsGenerator/specs/JobResultsArgs__GET_search_jobs_NAME_results.argspec: -------------------------------------------------------------------------------- 1 | # NOTE: The entire contents of this specification have been copied to 2 | # JobExportArgs__GET_search_jobs_export.argspec, which should be 3 | # updated (and regenerated) to reflect changes made to this file. 4 | # 5 | # TODO: Improve docs: Formatting of the description differs from that of 6 | # GET search/jobs/{search_id}/results. Otherwise all other parameters are identical. 7 | count 8 | Count 9 | int 10 | Sets the maximum number of results to return. 11 | - 12 | The maximum number of results. To return all available results, specify 0. 13 | === 14 | # TODO: Improve docs: Why isn't "field_list" deprecated when there is "f" present? 15 | f 16 | FieldList 17 | String[]-MULTIPLE 18 | Sets a list of fields to return for the event set. 19 | - 20 | A list of fields. 21 | === 22 | offset 23 | Offset 24 | int 25 | Specifies the index of the first result (inclusive) from which to begin returning data. This value is 0-indexed.

In Splunk 4.1+, negative offsets are allowed and are added to the count to compute the absolute offset (for example, offset=-1 is the last available offset). Offsets in the results are always absolute and never negative. The default value is 0. 26 | - 27 | The index of the first result to return. 28 | === 29 | # TODO: Improve docs: The referenced document does not actually document the enum constants. 30 | output_mode 31 | OutputMode 32 | OutputMode 33 | Sets the format of the output. 34 | - 35 | The output format. 36 | === 37 | search 38 | Search 39 | String 40 | Sets the post-processing search to apply to results. 41 | - 42 | The post-processing search query. 43 | === 44 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/FiredAlertGroupCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | /** 19 | * The {@code FiredAlertGroupCollection} class represents a collection of fired 20 | * alert groups. 21 | */ 22 | public class FiredAlertGroupCollection 23 | extends EntityCollection{ 24 | 25 | /** 26 | * Class constructor. 27 | * 28 | * @param service The connected {@code Service} instance. 29 | */ 30 | FiredAlertGroupCollection(Service service) { 31 | super(service, "alerts/fired_alerts", FiredAlertGroup.class); 32 | } 33 | 34 | /** 35 | * Class constructor. 36 | * 37 | * @param service The connected {@code Service} instance. 38 | * @param args Collection arguments that specify the number of entities to 39 | * return and how to sort them (see {@link CollectionArgs}). 40 | */ 41 | FiredAlertGroupCollection(Service service, Args args) { 42 | super(service, "alerts/fired_alerts", FiredAlertGroup.class, args); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | ## How to contribute 4 | 5 | If you would like to contribute to this project, see [Contributions to Splunk](https://www.splunk.com/en_us/form/contributions.html) for more information. 6 | 7 | ## Issues and bug reports 8 | 9 | If you're seeing some unexpected behavior with this project, please create an [issue](https://github.com/splunk/splunk-sdk-java/issues) on GitHub with the following information: 10 | 11 | 1. Version of this project you're using (ex: 1.4.0) 12 | 2. Platform version (ex: Windows Server 2012) 13 | 3. Framework version (ex: Java 8) 14 | 4. Splunk Enterprise version (ex: 8.0) 15 | 5. Other relevant information (ex: local/remote environment, Splunk network configuration, standalone or distributed deployment, are load balancers used) 16 | 17 | Alternatively, if you have a Splunk question please ask on [Splunk Answers](https://community.splunk.com/t5/Splunk-Development/ct-p/developer-tools). 18 | 19 | ## Pull requests 20 | 21 | We love to see pull requests! 22 | 23 | To create a pull request: 24 | 25 | 1. Fill out the [Individual Contributor Agreement](https://www.splunk.com/en_us/form/contributions.html). 26 | 2. Fork the [repository](https://github.com/splunk/splunk-sdk-java). 27 | 3. Make changes to the **develop** branch, preferably with tests. 28 | 4. Create a [pull request](https://github.com/splunk/splunk-sdk-java/pulls) against the **develop** branch. 29 | 30 | ## Contact us 31 | 32 | If you have a paid Splunk Enterprise or Splunk Cloud license, you can contact [Support](https://www.splunk.com/en_us/support-and-services.html) with questions. 33 | 34 | You can reach the Splunk Developer Platform team at _devinfo@splunk.com_. 35 | 36 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/EntityMetadataNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.EntityMetadata; 20 | 21 | import java.util.Map; 22 | 23 | class EntityMetadataNode extends ExplorerNode { 24 | EntityMetadataNode(EntityMetadata value) { 25 | super(value); 26 | setDisplayName("Metadata"); 27 | } 28 | 29 | @Override protected PropertyList getMetadata() { 30 | PropertyList list = super.getMetadata(); 31 | list.add(boolean.class, "canChangePermissions"); 32 | list.add(boolean.class, "canShareApp"); 33 | list.add(boolean.class, "canShareGlobal"); 34 | list.add(boolean.class, "canShareUser"); 35 | list.add(boolean.class, "canWrite"); 36 | list.add(String.class, "getApp"); 37 | list.add(String.class, "getOwner"); 38 | list.add(Map.class, "getPermissions"); 39 | list.add(String.class, "getSharing"); 40 | list.add(boolean.class, "isModifiable"); 41 | return list; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/Message.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code Message} class represents a message. Most messages are created by 21 | * Splunkd to inform the user of system problems, such as license quotas, 22 | * license expirations, misconfigured indexes, and disk space. 23 | */ 24 | public class Message extends Entity { 25 | 26 | /** 27 | * Class constructor. 28 | * 29 | * @param service The connected {@code Service} instance. 30 | * @param path The message endpoint. 31 | */ 32 | Message(Service service, String path) { 33 | super(service, path); 34 | } 35 | 36 | /** 37 | * Returns the title of this message. 38 | * 39 | * @return The message title. 40 | */ 41 | public String getKey() { 42 | return getTitle(); 43 | } 44 | 45 | /** 46 | * Returns the content of this message. 47 | * 48 | * @return The message text. 49 | */ 50 | public String getValue() { 51 | return getString(getKey()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/Logger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code Logger} class represents a specific Splunkd logging category. 21 | */ 22 | public class Logger extends Entity { 23 | 24 | /** 25 | * Class constructor. 26 | * 27 | * @param service The connected {@code Service} instance. 28 | * @param path The logger endpoint. 29 | */ 30 | Logger(Service service, String path) { 31 | super(service, path); 32 | } 33 | 34 | /** 35 | * Returns the logging level of this logger. Valid values are: "FATAL", 36 | * "CRIT", "WARN", "INFO", and "DEBUG". 37 | * 38 | * @return The logging level. 39 | */ 40 | public String getLevel() { 41 | return getString("level"); 42 | } 43 | 44 | /** 45 | * Sets the logging level of this logger. Valid values are: "FATAL", 46 | * "CRIT", "WARN", "INFO", and "DEBUG". 47 | * 48 | * @param level The logging level. 49 | */ 50 | public void setLevel(String level) { 51 | setCacheValue("level", level); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/SettingsNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class SettingsNode extends EntityNode { 22 | SettingsNode(Entity value) { 23 | super(value); 24 | setDisplayName("Settings"); 25 | } 26 | 27 | @Override protected PropertyList getMetadata() { 28 | PropertyList list = super.getMetadata(); 29 | list.add(String.class, "getSplunkDB"); 30 | list.add(String.class, "getSplunkHome"); 31 | list.add(boolean.class, "getEnableSplunkWebSSL"); 32 | list.add(String.class, "getHost"); 33 | list.add(int.class, "getHttpPort"); 34 | list.add(int.class, "getMgmtPort"); 35 | list.add(int.class, "getMinFreeSpace"); 36 | list.add(String.class, "getPass4SymmKey"); 37 | list.add(String.class, "getServerName"); 38 | list.add(String.class, "getSessionTimeout"); 39 | list.add(boolean.class, "getStartWebServer"); 40 | list.add(String.class, "getTrustedIP"); 41 | return list; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/HttpExceptionTest.java: -------------------------------------------------------------------------------- 1 | package com.splunk; 2 | 3 | import org.junit.BeforeClass; 4 | import org.junit.Test; 5 | 6 | import java.io.ByteArrayInputStream; 7 | import java.io.InputStream; 8 | 9 | import static org.junit.Assert.assertEquals; 10 | 11 | public class HttpExceptionTest { 12 | 13 | private static final String responseMessage = "Splunk VERY FATAL error"; 14 | private static final String responseMessageXML = "" 15 | + "" 16 | + responseMessage 17 | + ""; 18 | 19 | private static ResponseMessage xmlResponse; 20 | private static ResponseMessage stringResponse; 21 | 22 | @BeforeClass 23 | public static void setUp() { 24 | InputStream inXml = new ByteArrayInputStream(responseMessageXML.getBytes()); 25 | xmlResponse = new ResponseMessage(503, inXml); 26 | InputStream inString = new ByteArrayInputStream(responseMessage.getBytes()); 27 | stringResponse = new ResponseMessage(503, inString); 28 | } 29 | 30 | @Test 31 | public void testCreateFromXML() { 32 | HttpException e = HttpException.create(xmlResponse); 33 | assertEquals("Couldn't parse XML error details", responseMessage, e.getDetail()); 34 | assertEquals("create() modified response status code", 503, e.getStatus()); 35 | } 36 | 37 | @Test 38 | public void testCreateFromString() { 39 | HttpException e = HttpException.create(stringResponse); 40 | assertEquals("Raw response message was modified", responseMessage, e.getDetail()); 41 | assertEquals("create() modified response status code", 503, e.getStatus()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/MultiResultsReaderXml.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * The {@code MultiResultsReaderXml} class represents a streaming XML reader for 24 | * Splunk search results. This reader supports streams from export searches, 25 | * which might return one of more previews before returning final results. 26 | */ 27 | public class MultiResultsReaderXml 28 | extends MultiResultsReader { 29 | /** 30 | * Class constructor. 31 | * 32 | * Constructs a streaming XML reader for the event stream. You should only 33 | * attempt to parse an XML stream with this reader. Unpredictable results 34 | * may occur if you try to parse a stream with a different format. 35 | * 36 | * @param inputStream The XML stream to parse. 37 | * @throws IOException The IOException instance 38 | */ 39 | public MultiResultsReaderXml(InputStream inputStream) throws IOException { 40 | super(new ResultsReaderXml(inputStream, true)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/MultiResultsReaderJson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * The {@code MultiResultsReaderJson} class represents a streaming JSON reader 24 | * for Splunk search results. This reader supports streams from export searches, 25 | * which might return one of more previews before returning final results. 26 | */ 27 | public class MultiResultsReaderJson 28 | extends MultiResultsReader { 29 | /** 30 | * Class constructor. 31 | * 32 | * Constructs a streaming JSON reader for the event stream. You should only 33 | * attempt to parse a JSON stream with this reader. Unpredictable results 34 | * may occur if you try to parse a stream with a different format. 35 | * 36 | * @param inputStream The JSON stream to parse. 37 | * @throws IOException The IOException instance 38 | */ 39 | public MultiResultsReaderJson(InputStream inputStream) throws IOException { 40 | super(new ResultsReaderJson(inputStream, true)); 41 | } 42 | } -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/PropertyList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import java.util.ArrayList; 20 | import org.openide.nodes.PropertySupport; 21 | import org.openide.nodes.Sheet; 22 | 23 | public class PropertyList extends ArrayList { 24 | public void add(Class datatype, String getter) { 25 | add(datatype, getter, null); 26 | } 27 | 28 | public void add(Class datatype, String getter, String setter) { 29 | add(new PropertyInfo(datatype, getter, setter)); 30 | } 31 | 32 | public Sheet createSheet(Object object) { 33 | Sheet sheet = Sheet.createDefault(); 34 | Sheet.Set props = Sheet.createPropertiesSet(); 35 | try { 36 | for (PropertyInfo info : this) { 37 | props.put(new PropertySupport.Reflection( 38 | object, info.datatype, info.getter, info.setter)); 39 | } 40 | } 41 | catch (NoSuchMethodException e) { 42 | throw new RuntimeException(e.getMessage(), e); 43 | } 44 | sheet.put(props); 45 | return sheet; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/RegexpDataModelCalculation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * Represents a calculation on a data model object done by a regular expression. 22 | */ 23 | public class RegexpDataModelCalculation extends DataModelCalculation { 24 | private final String expression; 25 | private final String inputField; 26 | 27 | RegexpDataModelCalculation(String[] owner, String calculationID, 28 | Map generatedFields, String comment, 29 | boolean editable, String inputField, String expression) { 30 | super(owner, calculationID, generatedFields, comment, editable); 31 | this.expression = expression; 32 | this.inputField = inputField; 33 | } 34 | 35 | /** 36 | * @return regular expression specifying this calculation 37 | */ 38 | public String getExpression() { return this.expression; } 39 | 40 | /** 41 | * @return name of the field to apply the regular expression to. 42 | */ 43 | public String getInputField() { return this.inputField; } 44 | } 45 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/ServiceNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Service; 20 | 21 | class ServiceNode extends ExplorerNode { 22 | ServiceNode(Service service) { 23 | super(service.getInfo(), new ServiceKids(service)); 24 | setDisplayName(service.getInfo().getServerName()); 25 | } 26 | 27 | @Override protected PropertyList getMetadata() { 28 | return new PropertyList() {{ 29 | add(int.class, "getBuild"); 30 | add(String.class, "getCpuArch"); 31 | add(String[].class, "getLicenseKeys"); 32 | add(String.class, "getLicenseSignature"); 33 | add(String.class, "getLicenseState"); 34 | add(String.class, "getMasterGuid"); 35 | add(String.class, "getMode"); 36 | add(String.class, "getOsBuild"); 37 | add(String.class, "getOsVersion"); 38 | add(String.class, "getServerName"); 39 | add(String.class, "getVersion"); 40 | add(boolean.class, "isFree"); 41 | add(boolean.class, "isTrial"); 42 | }}; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/LicenseMessageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.util.Date; 20 | 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | 24 | public class LicenseMessageTest extends SDKTestCase { 25 | @Test 26 | public void testLicenseMessage() throws Exception { 27 | // SPL-83050: Known to fail. Should be fixed before Cupcake is released. 28 | EntityCollection licenseMessages = 29 | service.getLicenseMessages(); 30 | 31 | if (licenseMessages.values().size() == 0) { 32 | System.out.println("WARNING: No license messages found to test."); 33 | return; 34 | } 35 | 36 | for (LicenseMessage licenseMessage: licenseMessages.values()) { 37 | // Test getters 38 | Assert.assertTrue(licenseMessage.getCreationTime().after(new Date(0))); 39 | licenseMessage.getCategory(); 40 | licenseMessage.getDescription(); 41 | licenseMessage.getPoolId(); 42 | licenseMessage.getSeverity(); 43 | licenseMessage.getSlaveId(); 44 | licenseMessage.getStackId(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /argsGenerator/specs/CollectionArgs__GET_collection.argspec: -------------------------------------------------------------------------------- 1 | app 2 | App 3 | String 4 | Sets the app context in which to list the collection. 5 | - 6 | The app context in which to list the collection. A {@code null} value indicates no app context, and a value of {@code "-"} indicates an app wildcard. 7 | === 8 | owner 9 | Owner 10 | String 11 | Sets the owner context in which to list the collection. 12 | - 13 | The owner context in which to list the collection. A value of {@code "-"} indicates a wildcard, and a {@code null} value indicates no owner context. 14 | === 15 | sharing 16 | Sharing 17 | String 18 | Sets the sharing context in which to list the collection. 19 | - 20 | The sharing context in which to list the collection. Valid values are "user", "app", "global", and "system". 21 | === 22 | count 23 | Count 24 | int 25 | Sets the maximum number of entries to return. 26 | - 27 | The maximum number of entries to return. To return all entries, specify 0. 28 | === 29 | offset 30 | Offset 31 | int 32 | Sets the index of the first entry to return. 33 | - 34 | The index of the first entry to return. 35 | === 36 | search 37 | Search 38 | String 39 | Sets a search query to filter the response. The response matches field values against the search query. For example, "foo" matches any object that has "foo" as a substring in a field, and "field_name=field_value" restricts the match to a single field. 40 | - 41 | A search query to filter the response. 42 | === 43 | sort_dir 44 | SortDirection 45 | SortDirection 46 | Sets the direction to sort entries. 47 | - 48 | The sorting order--ascending or descending. 49 | === 50 | sort_key 51 | SortKey 52 | String 53 | Sets the field to use for sorting. 54 | - 55 | The field to sort by. 56 | === 57 | sort_mode 58 | SortMode 59 | SortMode 60 | Sets the mode to use for sorting. 61 | - 62 | The collating sequence for sorting entries. 63 | === 64 | -------------------------------------------------------------------------------- /launchers/shim/shim/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : shim Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this shim application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your shim application. 9 | 10 | 11 | shim.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | shim.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | shim.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named shim.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/IndexCollectionArgs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code IndexCollectionArgs} class contains arguments for retrieving 21 | * indexes from a collection (see {@link Service#getIndexes}). 22 | */ 23 | public class IndexCollectionArgs extends CollectionArgs { 24 | 25 | /** 26 | * Class constructor. 27 | */ 28 | public IndexCollectionArgs() { super(); } 29 | 30 | /* BEGIN AUTOGENERATED CODE */ 31 | 32 | /** 33 | * Sets the maximum number of entries to return. 34 | * 35 | * @param count 36 | * The maximum number of entries to return. To return all entries, specify -1. 37 | */ 38 | public void setCount(int count) { 39 | super.setCount(count); 40 | } 41 | 42 | /** 43 | * Sets whether to omits certain index details to provide a faster response. 44 | * 45 | * @param summarize 46 | * {@code true} to omit index details for a faster response, 47 | * {@code false} if not. 48 | */ 49 | public void setSummarize(boolean summarize) { 50 | this.put("summarize", summarize); 51 | } 52 | 53 | /* END AUTOGENERATED CODE */ 54 | } 55 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/DeploymentServerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | public class DeploymentServerTest extends SDKTestCase { 23 | @Test 24 | public void testDeploymentServer() throws Exception { 25 | if (service.versionIsAtLeast("6.0")) { 26 | // WORKAROUND (DVPL-2993): The deployment server has changed in Splunk 6, and is not yet supported. 27 | return; 28 | } 29 | 30 | EntityCollection deploymentServers = 31 | service.getDeploymentServers(); 32 | if (deploymentServers.values().size() == 0) { 33 | System.out.println("WARNING: No DeploymentServer entities to test"); 34 | return; 35 | } 36 | 37 | for (DeploymentServer deploymentServer : deploymentServers.values()) { 38 | // Ensure getters throw no exceptions 39 | deploymentServer.isDisabled(); 40 | Assert.assertTrue(deploymentServer.getWhitelistByIndex(0).length() > 0); 41 | for (int i=0; i<10; i++) { 42 | deploymentServer.getWhitelistByIndex(i); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /splunk/src/test/java/com/splunk/DeploymentTenantTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | public class DeploymentTenantTest extends SDKTestCase { 23 | @Test 24 | public void testDeploymentTenant() throws Exception { 25 | if (service.versionIsAtLeast("6.0")) { 26 | // WORKAROUND (DVPL-2993): The deployment server has changed in Splunk 6, and is not yet supported. 27 | return; 28 | } 29 | 30 | EntityCollection deploymentTenants = 31 | service.getDeploymentTenants(); 32 | if (deploymentTenants.values().size() == 0) { 33 | System.out.println("WARNING: No DeploymentTenant entities to test"); 34 | return; 35 | } 36 | 37 | for (DeploymentTenant deploymentTenant: deploymentTenants.values()) { 38 | // Ensure getters throw no exceptions 39 | deploymentTenant.isDisabled(); 40 | Assert.assertTrue(deploymentTenant.getWhitelistByIndex(0).length() > 0); 41 | for (int i=0; i<10; i++) { 42 | deploymentTenant.getWhitelistByIndex(i); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/get_job/Program.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.get_job; 18 | 19 | import com.splunk.*; 20 | 21 | /** 22 | * This example shows a better way to retrieve a Job by its sid 23 | * using the new getJob() method. 24 | * 25 | * Previously, the only way to do this would be the following: 26 | * 27 | * Job job = service.getJobs().get(sid); 28 | * 29 | * The above has a significant overhead of getting all search jobs from 30 | * the Splunk REST API in order to get a single Job. 31 | * 32 | */ 33 | 34 | public class Program { 35 | public static void main(String[] args) { 36 | Command command = Command.splunk("info").parse(args); 37 | Service service = Service.connect(command.opts); 38 | 39 | String sid = service.search("search index=_internal | head 5").getSid(); 40 | Job job = service.getJob(sid); 41 | 42 | while (!job.isDone()) { 43 | job.refresh(); 44 | try { 45 | Thread.sleep(1000); 46 | } catch (Exception e) { 47 | System.out.println(e.getMessage()); 48 | } 49 | } 50 | 51 | System.out.println("Number of events found: " + job.getEventCount()); 52 | } 53 | } -------------------------------------------------------------------------------- /splunk/staticdocs.css: -------------------------------------------------------------------------------- 1 | /* Page background color */ 2 | body { background: transparent } 3 | 4 | /* Headings */ 5 | h1 { font-size: 145% } 6 | 7 | body { 8 | font-family: Arial, sans-serif; 9 | color: #555; 10 | font-size: 13px; 11 | line-height: 18px; 12 | margin:0 auto; 13 | padding-left:5px; 14 | padding-right:5px; 15 | } 16 | 17 | table { 18 | border-width: 0px; 19 | border-spacing: 0px; 20 | border-style: outset; 21 | border-color: gray; 22 | border-collapse: collapse; 23 | background-color: white; 24 | /*margin-top:15px; */ 25 | margin-bottom: 15px; 26 | } 27 | 28 | th { 29 | border-width: 0px; 30 | padding: 2px 6px 1px 6px; 31 | border-style: inset; 32 | border-color: #e2e2e2; 33 | background-color: #eeeeee; 34 | text-align: left; 35 | } 36 | 37 | td { 38 | border-width: 0px; 39 | padding: 2px 6px 1px 6px; 40 | border-style: inset; 41 | border-color: #e2e2e2; 42 | background-color: white; 43 | } 44 | 45 | a { 46 | color: rgb(8, 89, 130); 47 | text-decoration: none; 48 | } 49 | 50 | /* Font used in left-hand frame lists */ 51 | .FrameTitleFont { font-size: 100%; font-family: Arial, sans-serif; color:#000000 } 52 | .FrameHeadingFont { font-size: 100%; font-family: Arial, sans-serif; color:#000000 } 53 | .FrameItemFont { font-size: 100%; font-family: Arial, sans-serif; color:#000000 } 54 | 55 | 56 | /* Navigation bar fonts and colors */ 57 | .NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ 58 | .NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ 59 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} 60 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} 61 | 62 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} 63 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} 64 | 65 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/ApplicationSetup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code ApplicationSetup} class represents the setup information for a 21 | * Splunk app. 22 | */ 23 | public class ApplicationSetup extends Entity { 24 | 25 | /** 26 | * Class constructor. 27 | * 28 | * @param service The connected {@code Service} instance. 29 | * @param path The application endpoint. 30 | */ 31 | ApplicationSetup(Service service, String path) { 32 | super(service, path + "/setup"); 33 | } 34 | 35 | /** 36 | * Indicates whether to reload the objects contained in the 37 | * locally-installed app. 38 | * 39 | * @return {@code true} if objects are reloaded, {@code false} if not. 40 | */ 41 | public boolean getRefresh() { 42 | return getBoolean("refresh", false); 43 | } 44 | 45 | /** 46 | * Returns the app's setup information in XML format. 47 | * 48 | * @return The setup information for the app. 49 | */ 50 | public String getSetupXml() { 51 | return getString("eai:setup"); 52 | } 53 | 54 | // Because all other keys are dynamic and context specific, they should 55 | // be retrieved using Map (dictionary) get access. 56 | } 57 | 58 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/SavedSearchCollectionArgs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code SavedSearchCollectionArgs} class contains arguments getting a 21 | * collection of saved searches. 22 | */ 23 | public class SavedSearchCollectionArgs extends CollectionArgs { 24 | 25 | /** 26 | * Class constructor. 27 | */ 28 | public SavedSearchCollectionArgs() { super(); } 29 | 30 | /* BEGIN AUTOGENERATED CODE */ 31 | 32 | /** 33 | * Sets the earliest time for which to display the scheduled times for scheduled searches (not just the next run time). 34 | * 35 | * @param earliestTime 36 | * The earliest time. 37 | */ 38 | public void setEarliestTime(String earliestTime) { 39 | this.put("earliest_time", earliestTime); 40 | } 41 | 42 | /** 43 | * Sets the latest time until which to display the scheduled times for scheduled searches (not just the next run time). 44 | * 45 | * @param latestTime 46 | * The latest time. 47 | */ 48 | public void setLatestTime(String latestTime) { 49 | this.put("latest_time", latestTime); 50 | } 51 | 52 | /* END AUTOGENERATED CODE */ 53 | } 54 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | import java.util.Map; 20 | 21 | /** 22 | * The {@code Input} class represents a data input. This class is the base for 23 | * all typed {@code Input} classes and is also used when Splunk does not 24 | * recognize an input kind. 25 | */ 26 | public class Input extends Entity { 27 | 28 | /** 29 | * Class constructor. 30 | * 31 | * @param service The connected {@code Service} instance. 32 | * @param path The input endpoint. 33 | */ 34 | Input(Service service, String path) { 35 | super(service, path); 36 | } 37 | 38 | /** 39 | * Returns an {@code InputKind} representing this input's type. 40 | * 41 | * The input kind is inferred from the input's path. 42 | * @return InputKind instance 43 | */ 44 | public InputKind getKind() { 45 | String[] pathComponents = 46 | Util.substringAfter(this.path, "/data/inputs/", null).split("/"); 47 | 48 | String kindPath; 49 | if (pathComponents[0].equals("tcp")) { 50 | kindPath = "tcp/" + pathComponents[1]; 51 | } else { 52 | kindPath = pathComponents[0]; 53 | } 54 | return InputKind.create(kindPath); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /splunk/src/test/resources/data/atom/atom_feed_with_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | roles 6 | https://localhost:8089/services/authorization/roles 7 | 2013-01-22T08:52:24-08:00 8 | 9 | 10 | Splunk 11 | 12 | 13 | 0 14 | 30 15 | 0 16 | 17 | This role will be disabled after the Enterprise Trial License expires 18 | 19 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/DataModelCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import java.util.Map; 19 | 20 | public class DataModelCollection extends EntityCollection { 21 | DataModelCollection(Service service) { 22 | super(service, "datamodel/model", DataModel.class); 23 | this.refreshArgs.put("concise", "0"); 24 | } 25 | 26 | /** 27 | * Creates an entity in this collection. 28 | * 29 | * @param name The name of the entity. 30 | * @return The entity. 31 | */ 32 | @Override 33 | public DataModel create(String name) { 34 | return create(name, (Map)null); 35 | } 36 | 37 | /** 38 | * Creates an entity in this collection. 39 | * 40 | * @param name The name of the entity. 41 | * @param args Arguments for creating the entity. 42 | * @return The entity. 43 | */ 44 | @Override 45 | public DataModel create(String name, Map args) { 46 | Args revisedArgs = Args.create(args); 47 | // concise=0 forces the server to return all details of the newly 48 | // created data model. 49 | if (!args.containsKey("concise")) { 50 | revisedArgs = revisedArgs.add("concise", "0"); 51 | } 52 | return super.create(name, revisedArgs); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/BooleanPivotRowSplit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package com.splunk; 17 | 18 | import com.google.gson.JsonElement; 19 | import com.google.gson.JsonObject; 20 | import com.google.gson.JsonPrimitive; 21 | 22 | /** 23 | * Represents a row split on a boolean valued field in a pivot. 24 | */ 25 | public class BooleanPivotRowSplit extends PivotRowSplit { 26 | private final String falseDisplayValue; 27 | private final String trueDisplayValue; 28 | 29 | BooleanPivotRowSplit(DataModelObject dataModelObject, String field, String label, 30 | String trueDisplayValue, String falseDisplayValue) { 31 | super(dataModelObject, field, label); 32 | this.trueDisplayValue = trueDisplayValue; 33 | this.falseDisplayValue = falseDisplayValue; 34 | } 35 | 36 | public String getTrueDisplayValue() { return this.trueDisplayValue; } 37 | public String getFalseDisplayValue() { return this.falseDisplayValue; } 38 | 39 | @Override 40 | JsonElement toJson() { 41 | JsonObject root = new JsonObject(); 42 | 43 | addCommonFields(root); 44 | 45 | root.add("trueLabel", new JsonPrimitive(this.trueDisplayValue)); 46 | root.add("falseLabel", new JsonPrimitive(this.falseDisplayValue)); 47 | 48 | return root; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/IndexCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code IndexCollection} class represents a collection of indexes. 21 | */ 22 | public class IndexCollection extends EntityCollection { 23 | /** 24 | * Class constructor. 25 | * 26 | * @param service The connected {@code Service} instance. 27 | */ 28 | IndexCollection(Service service) { 29 | super(service, "data/indexes", Index.class); 30 | } 31 | 32 | /** 33 | * Class constructor. 34 | * 35 | * @param service The connected {@code Service} instance. 36 | * @param args Collection arguments that specify the number of entities to 37 | * return and how to sort them (see {@link IndexCollectionArgs}). 38 | */ 39 | IndexCollection(Service service, Args args) { 40 | super(service, "data/indexes", Index.class, args); 41 | } 42 | 43 | /** 44 | * {@inheritDoc} 45 | */ 46 | public Index remove(String key) { 47 | if (this.service.versionCompare("5.0") < 0) { 48 | throw new UnsupportedOperationException( 49 | "Indexes cannot be deleted via the REST API in versions " + 50 | "prior to 5.0"); 51 | } else { 52 | return (Index)super.remove(key); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/LicenseNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | import com.splunk.License; 21 | 22 | import java.util.Date; 23 | 24 | class LicenseNode extends EntityNode { 25 | LicenseNode(Entity value) { 26 | super(value); 27 | License license = (License)value; 28 | String displayName = license.getLabel(); 29 | if (displayName == null) displayName = license.getName(); 30 | setDisplayName(displayName); 31 | } 32 | 33 | @Override protected PropertyList getMetadata() { 34 | PropertyList list = super.getMetadata(); 35 | list.add(Date.class, "getCreationTime"); 36 | list.add(Date.class, "getExpirationTime"); 37 | list.add(String[].class, "getFeatures"); 38 | list.add(String.class, "getGroupId"); 39 | list.add(String.class, "getLabel"); 40 | list.add(String.class, "getLicenseHash"); 41 | list.add(int.class, "getMaxViolations"); 42 | list.add(long.class, "getQuota"); 43 | list.add(String[].class, "getSourceTypes"); 44 | list.add(String.class, "getStackId"); 45 | list.add(String.class, "getStatus"); 46 | list.add(String.class, "getType"); 47 | list.add(int.class, "getWindowPeriod"); 48 | return list; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /splunk/src/main/java/com/splunk/LicenseStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk; 18 | 19 | /** 20 | * The {@code LicenseStack} class represents a license stack, which is 21 | * a collection of licenses of the same type. 22 | */ 23 | public class LicenseStack extends Entity { 24 | 25 | /** 26 | * Class constructor. 27 | * 28 | * @param service The connected {@code Service} instance. 29 | * @param path The license stack endpoint. 30 | */ 31 | LicenseStack(Service service, String path) { 32 | super(service, path); 33 | } 34 | 35 | /** 36 | * Returns the label of this license stack. 37 | * 38 | * @return This license stack's label, or {@code null} if not specified. 39 | */ 40 | public String getLabel() { 41 | return getString("label", null); 42 | } 43 | 44 | /** 45 | * Returns the combined daily indexing quota for all of the licenses 46 | * in this license stack. 47 | * 48 | * @return The daily indexing quota, in bytes. 49 | */ 50 | public long getQuota() { 51 | return getByteCount("quota", 0); 52 | } 53 | 54 | /** 55 | * Returns the license type of the licenses in this license stack. 56 | * 57 | * @return The license type. 58 | */ 59 | public String getType() { 60 | return getString("type"); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /examples/src/main/java/com/splunk/examples/explorer/DistributedConfigurationNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Splunk, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"): you may 5 | * not use this file except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.splunk.examples.explorer; 18 | 19 | import com.splunk.Entity; 20 | 21 | class DistributedConfigurationNode extends EntityNode { 22 | DistributedConfigurationNode(Entity value) { 23 | super(value); 24 | setDisplayName("Distributed Configuration"); 25 | } 26 | 27 | @Override protected PropertyList getMetadata() { 28 | PropertyList list = super.getMetadata(); 29 | list.add(boolean.class, "getAutoAddServers"); 30 | list.add(String[].class, "getBlacklistNames"); 31 | list.add(String[].class, "getBlacklistUrls"); 32 | list.add(int.class, "getCheckTimedOutServersFrequency"); 33 | list.add(int.class, "getHeartbeatFrequency"); 34 | list.add(String.class, "getHeartbeatMcastAddress"); 35 | list.add(int.class, "getHeartbeatPort"); 36 | list.add(boolean.class, "getRemovedTimedOutServers"); 37 | list.add(int.class, "getServerTimeout"); 38 | list.add(String.class, "getServers"); 39 | list.add(boolean.class, "getShareBundles"); 40 | list.add(boolean.class, "getSkipOurselves"); 41 | list.add(int.class, "getStatusTimeout"); 42 | list.add(int.class, "getTtl"); 43 | list.add(boolean.class, "isDisabled"); 44 | return list; 45 | } 46 | } 47 | --------------------------------------------------------------------------------