Package com.splunk.splunkjenkins
Class SplunkJenkinsInstallation
java.lang.Object
hudson.model.Descriptor<GlobalConfiguration>
jenkins.model.GlobalConfiguration
com.splunk.splunkjenkins.SplunkJenkinsInstallation
- All Implemented Interfaces:
ExtensionPoint
,Describable<GlobalConfiguration>
,Saveable
,OnMaster
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
FieldsFields inherited from class hudson.model.Descriptor
clazz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canPostRaw
(EventType eventType) Check whether we can optimize sending process, e.g.boolean
configure
(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData) doCheckHost
(String hostName) doCheckIgnoredJobs
(String value) doCheckMaxEventsBatchSize
(int value) doCheckScriptContent
(String value) doCheckToken
(Secret token) doTestHttpInput
(String host, int port, Secret token, boolean useSSL, String metaDataConfig) static SplunkJenkinsInstallation
get()
groovy.lang.GroovyCodeSource
getCode()
getHost()
long
long
getMetaData
(String keyName) getMetadataSource
(String suffix) getPort()
long
get cached script contentsgetToken()
static void
initOnAgent
(SplunkJenkinsInstallation config) Note: this method is meant to be called on agent only!boolean
boolean
isEventDisabled
(EventType eventType) boolean
isJobIgnored
(String jobUrl) static boolean
boolean
boolean
boolean
isUseSSL()
boolean
isValid()
check if configured correctlyfinal void
load()
static void
markComplete
(boolean completed) mark this plugin as initiatedvoid
setEnabled
(boolean enabled) void
setGlobalPipelineFilter
(Boolean globalPipelineFilter) void
void
setIgnoredJobs
(String ignoredJobs) void
setMaxEventsBatchSize
(long maxEventsBatchSize) void
setMetaDataConfig
(String metaDataConfig) void
setMetadataHost
(String metadataHost) void
setMetadataItemSet
(Set<MetaDataConfigItem> metadataItemSet) void
setMetadataSource
(String metadataSource) void
void
setRawEventEnabled
(boolean rawEventEnabled) void
setRetriesOnError
(long retriesOnError) void
setScriptContent
(String scriptContent) void
setScriptPath
(String scriptPath) void
setSplunkAppUrl
(String splunkAppUrl) void
void
setUseSSL
(boolean useSSL) toMap()
protected void
Methods inherited from class jenkins.model.GlobalConfiguration
all, getDescriptor, getGlobalConfigPage
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getT, getViewPage, isInstance, isSubTypeOf, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
Field Details
-
metaDataProperties
-
-
Constructor Details
-
SplunkJenkinsInstallation
public SplunkJenkinsInstallation(boolean useConfigFile) -
SplunkJenkinsInstallation
public SplunkJenkinsInstallation()
-
-
Method Details
-
load
public final void load()- Overrides:
load
in classDescriptor<GlobalConfiguration>
-
get
-
isLogHandlerRegistered
public static boolean isLogHandlerRegistered()- Returns:
- true if the plugin had been setup by Jenkins (constructor had been called)
-
markComplete
public static void markComplete(boolean completed) mark this plugin as initiated- Parameters:
completed
- mark the init as initiate completed
-
initOnAgent
Note: this method is meant to be called on agent only!- Parameters:
config
- the SplunkJenkinsInstallation to be used on Agent
-
configure
public boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData) throws Descriptor.FormException - Overrides:
configure
in classGlobalConfiguration
- Throws:
Descriptor.FormException
-
doCheckHost
-
doCheckToken
-
doTestHttpInput
public FormValidation doTestHttpInput(@QueryParameter String host, @QueryParameter int port, @QueryParameter Secret token, @QueryParameter boolean useSSL, @QueryParameter String metaDataConfig) -
doCheckScriptContent
-
doCheckMaxEventsBatchSize
-
doCheckIgnoredJobs
-
updateCache
protected void updateCache() -
isValid
public boolean isValid()check if configured correctly- Returns:
- true setup is completed
-
getScript
get cached script contents- Returns:
- script content
-
getCode
public groovy.lang.GroovyCodeSource getCode() -
isRawEventEnabled
public boolean isRawEventEnabled() -
canPostRaw
Check whether we can optimize sending process, e.g. if we need to send 1000 lines for one job console log, and we can specify host,source,sourcetype,index only once in query parameter if raw event is supported, instead of sending 1000 times in request body- Parameters:
eventType
- does this type of text need to be logged to splunk line by line- Returns:
- true if HEC supports specify metadata in url query parameter
-
getToken
-
getTokenValue
-
getMaxRetries
public long getMaxRetries() -
getMetaData
- Parameters:
keyName
- such as host,source,index- Returns:
- the configured metadata
-
getJsonUrl
-
getRawUrl
-
isEnabled
public boolean isEnabled() -
isEventDisabled
-
isJobIgnored
-
setEnabled
public void setEnabled(boolean enabled) -
getHost
-
setHost
-
setToken
-
isUseSSL
public boolean isUseSSL() -
setUseSSL
public void setUseSSL(boolean useSSL) -
getMaxEventsBatchSize
public long getMaxEventsBatchSize() -
setMaxEventsBatchSize
public void setMaxEventsBatchSize(long maxEventsBatchSize) -
setRawEventEnabled
public void setRawEventEnabled(boolean rawEventEnabled) -
getMetaDataConfig
-
setMetaDataConfig
-
getPort
-
setPort
-
getRetriesOnError
public long getRetriesOnError() -
setRetriesOnError
public void setRetriesOnError(long retriesOnError) -
getScriptPath
-
setScriptPath
-
getScriptContent
-
setScriptContent
-
toMap
-
getScriptOrDefault
-
getSplunkAppUrl
-
getAppUrlOrHelp
-
setSplunkAppUrl
-
getMetadataItemSet
-
getMetadataHost
-
setMetadataHost
-
setMetadataItemSet
-
getMetadataSource
-
getMetadataSource
-
setMetadataSource
-
getIgnoredJobs
-
setIgnoredJobs
-
getGlobalPipelineFilter
-
setGlobalPipelineFilter
-
isPipelineFilterEnabled
public boolean isPipelineFilterEnabled()
-