Class SplunkJenkinsInstallation

All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, OnMaster

@Extension public class SplunkJenkinsInstallation extends GlobalConfiguration
  • Field Details

    • metaDataProperties

      public transient Properties metaDataProperties
  • Constructor Details

    • SplunkJenkinsInstallation

      public SplunkJenkinsInstallation(boolean useConfigFile)
    • SplunkJenkinsInstallation

      public SplunkJenkinsInstallation()
  • Method Details

    • load

      public final void load()
      Overrides:
      load in class Descriptor<GlobalConfiguration>
    • get

      public static SplunkJenkinsInstallation 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

      public static void initOnAgent(SplunkJenkinsInstallation config)
      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 class GlobalConfiguration
      Throws:
      Descriptor.FormException
    • doCheckHost

      public FormValidation doCheckHost(@QueryParameter("value") String hostName)
    • doCheckToken

      public FormValidation doCheckToken(@QueryParameter("value") Secret token)
    • doTestHttpInput

      public FormValidation doTestHttpInput(@QueryParameter String host, @QueryParameter int port, @QueryParameter Secret token, @QueryParameter boolean useSSL, @QueryParameter String metaDataConfig)
    • doCheckScriptContent

      public FormValidation doCheckScriptContent(@QueryParameter String value)
    • doCheckMaxEventsBatchSize

      public FormValidation doCheckMaxEventsBatchSize(@QueryParameter int value)
    • doCheckIgnoredJobs

      public FormValidation doCheckIgnoredJobs(@QueryParameter String value)
    • updateCache

      protected void updateCache()
    • isValid

      public boolean isValid()
      check if configured correctly
      Returns:
      true setup is completed
    • getScript

      public String getScript()
      get cached script contents
      Returns:
      script content
    • getCode

      public groovy.lang.GroovyCodeSource getCode()
    • isRawEventEnabled

      public boolean isRawEventEnabled()
    • canPostRaw

      public boolean canPostRaw(EventType eventType)
      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

      public Secret getToken()
    • getTokenValue

      @NonNull public String getTokenValue()
    • getMaxRetries

      public long getMaxRetries()
    • getMetaData

      public String getMetaData(String keyName)
      Parameters:
      keyName - such as host,source,index
      Returns:
      the configured metadata
    • getJsonUrl

      public String getJsonUrl()
    • getRawUrl

      public String getRawUrl()
    • isEnabled

      public boolean isEnabled()
    • isEventDisabled

      public boolean isEventDisabled(EventType eventType)
    • isJobIgnored

      public boolean isJobIgnored(String jobUrl)
    • setEnabled

      public void setEnabled(boolean enabled)
    • getHost

      public String getHost()
    • setHost

      public void setHost(String host)
    • setToken

      public void setToken(Secret token)
    • 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

      public String getMetaDataConfig()
    • setMetaDataConfig

      public void setMetaDataConfig(String metaDataConfig)
    • getPort

      public Integer getPort()
    • setPort

      public void setPort(Integer port)
    • getRetriesOnError

      public long getRetriesOnError()
    • setRetriesOnError

      public void setRetriesOnError(long retriesOnError)
    • getScriptPath

      public String getScriptPath()
    • setScriptPath

      public void setScriptPath(String scriptPath)
    • getScriptContent

      public String getScriptContent()
    • setScriptContent

      public void setScriptContent(String scriptContent)
    • toMap

      public Map toMap()
    • getScriptOrDefault

      public String getScriptOrDefault()
    • getSplunkAppUrl

      public String getSplunkAppUrl()
    • getAppUrlOrHelp

      public String getAppUrlOrHelp()
    • setSplunkAppUrl

      public void setSplunkAppUrl(String splunkAppUrl)
    • getMetadataItemSet

      public Set<MetaDataConfigItem> getMetadataItemSet()
    • getMetadataHost

      public String getMetadataHost()
    • setMetadataHost

      public void setMetadataHost(String metadataHost)
    • setMetadataItemSet

      public void setMetadataItemSet(Set<MetaDataConfigItem> metadataItemSet)
    • getMetadataSource

      public String getMetadataSource()
    • getMetadataSource

      public String getMetadataSource(String suffix)
    • setMetadataSource

      public void setMetadataSource(String metadataSource)
    • getIgnoredJobs

      public String getIgnoredJobs()
    • setIgnoredJobs

      public void setIgnoredJobs(String ignoredJobs)
    • getGlobalPipelineFilter

      public Boolean getGlobalPipelineFilter()
    • setGlobalPipelineFilter

      public void setGlobalPipelineFilter(Boolean globalPipelineFilter)
    • isPipelineFilterEnabled

      public boolean isPipelineFilterEnabled()