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.SelfNested 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 TypeMethodDescriptionbooleancanPostRaw(EventType eventType) Check whether we can optimize sending process, e.g.booleanconfigure(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 SplunkJenkinsInstallationget()groovy.lang.GroovyCodeSourcegetCode()getHost()longlonggetMetaData(String keyName) getMetadataSource(String suffix) getPort()longget cached script contentsgetToken()static voidinitOnAgent(SplunkJenkinsInstallation config) Note: this method is meant to be called on agent only!booleanbooleanisEventDisabled(EventType eventType) booleanisJobIgnored(String jobUrl) static booleanbooleanbooleanbooleanisUseSSL()booleanisValid()check if configured correctlyfinal voidload()static voidmarkComplete(boolean completed) mark this plugin as initiatedvoidsetEnabled(boolean enabled) voidsetGlobalPipelineFilter(Boolean globalPipelineFilter) voidvoidsetIgnoredJobs(String ignoredJobs) voidsetMaxEventsBatchSize(long maxEventsBatchSize) voidsetMetaDataConfig(String metaDataConfig) voidsetMetadataHost(String metadataHost) voidsetMetadataItemSet(Set<MetaDataConfigItem> metadataItemSet) voidsetMetadataSource(String metadataSource) voidvoidsetRawEventEnabled(boolean rawEventEnabled) voidsetRetriesOnError(long retriesOnError) voidsetScriptContent(String scriptContent) voidsetScriptPath(String scriptPath) voidsetSplunkAppUrl(String splunkAppUrl) voidvoidsetUseSSL(boolean useSSL) toMap()protected voidMethods inherited from class jenkins.model.GlobalConfiguration
all, getDescriptor, getGlobalConfigPageMethods 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:
loadin 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:
configurein 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()
-