Plugin can be installed and used with global configuration. Below are set of features that can be used individually.
- SumoUpload - The function provides an ability to upload data from Files directly to Sumo Logic. Data is sent to the HTTP Source URL mentioned in the Global Configuration.
Sumologic-publisher
need Pipeline Rest API, GIT, metrics, subversion and junit. If not present,Sumologic-publisher
will install these plugins as a part of internal dependency.- Hosted Collector and HTTP source on SumoLogic server.
In manage plugins
, search for sumologic-publisher
version 2.2.2
and install the plugin.
Tested with Jenkins version 2.361.4
and java version 11. In case of any issue, please raise a issue.
-
SumoLogic Portal Name - Eg- service.sumologic.com (where hosted collector resides).
-
Enable proxy settings - Check to enable proxy settings
-
Proxy Host - Input the proxy server URL. e.g proxy.example.com
-
Proxy Port - Input the port for the proxy server.
-
Enable Proxy Authentication - Check to enable authentication for the proxy.
-
Username - Input the username to use for the proxy.
-
Password - Input the password to use for the proxy.
-
Metric Data Prefix - Can be the name of the Jenkins Master on which plugin is installed or name with you can distinguish Jenkins Master.
-
HTTP Source URL - URL of the HTTP Logs and Metrics Sumo Logic source.
-
Source Category - Source Category defined for the source provided in the Http Source URL.
-
Keep Old Configuration for Jobs
- Enable to send old configuration for jobs.
-
Types of Logs
- Metric Data - To send metric information.
- Audit Logs - To send audit information like login, Logout, Login Failure, configuration changes to jobs, changes to jenkins.
- Periodic Logs - To send periodic information like Node information, Master information, Shutdown events, Jenkins system logs.
- SCM Logs - To send Source control Management logs related to builds.
-
Enable Job Status for All Jobs
- Select to send status for all jobs
-
Enable Console Logs for All Jobs
- Select to send console logs for all jobs.
In case of specific Jobs
- Select to send console logs for all jobs.
-
For Freestyle and maven Project
-
For Pipeline Jobs
Groovy configuration script for Jenkins post-initialisation
The purpose of this script is to automate the global configuration of plugin when Jenkins starts, so that no manual intervention is required via UI afterwards.
This example of Groovy script file should have .groovy
extension and be placed in the directory $JENKINS_HOME/init.groovy.d/.
Download the SumoLogicPublisherConfiguration.groovy file.
- Make sure you are adjusting the values for fields according to your need.
-
The following build environment is required to build the plugin
Java 11
andMaven 3.6.x
.
-
Run
mvn clean install
ormvn package
.Commands will create a
sumologic-publisher.hpi
in target folder. -
Upload the
sumologic-publisher.hpi
in advanced section of manage plugin in Jenkins. -
After success building the plugin through
mvn clean install
run : $ export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n" $ mvn hpi:run
refer : https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial#Plugintutorial-DebuggingaPlugin
The Function can be used in Jenkins Pipelines to send files data to Sumo Logic. Function allow below properties:-
- file - Provide a file path or a directory path. If the value is a directory then data from all files within the directory will be sent to Sumo Logic.
- includePathPattern - Provide a pattern to include file names or extension. For eg:- *.json will include all json files only.
- excludePathPattern - Provide a pattern to exclude file names or extension. For eg:- *.json will exclude all json files only.
- text - Provide any string that will be sent to Sumo Logic.
- keyValueMap - Provide a key value map that will be converted to JSON and sent to Sumo Logic.
- workingDir - Provides the path of the directory where files are present. The path will be searched in the node where the Pipeline Step is executed.
- fields - Provide a key value map that will be sent as X-Sumo-Fields to Sumo Logic.
Below are some example uses of the Step Function :-
- Upload a file/folder from the workspace (or a String) to Sumo Logic.
SumoUpload(file:'file.txt')
SumoUpload(file:'someFolder')
- Upload with include/exclude patterns. The option accepts a comma-separated list of patterns.
SumoUpload(includePathPattern:'**/*', excludePathPattern:'**/*.log,**/*.json')
- Upload file from master directory when Pipeline Stage is running on a agent. Below will send File.txt file present in Archive Folder of the job pipeline on master system.
node('master')
{
SumoUpload(file: "File.txt", workingDir: "$JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/archive")
}
- Upload a text to Sumo Logic with Fields.
script{
fields = [
jenkins_master: "test_master",
result: currentBuild.currentResult
]
}
SumoUpload(text: "This is test String", fields: fields)
- Upload a Key Value map as JSON to Sumo Logic.
script{
deploy_event = [
event_name: STAGE_NAME,
result: currentBuild.currentResult
]
}
SumoUpload(keyValueMap: deploy_event)
For Full Change Log, Visit.
The sumologic-publisher is licensed under the apache v2.0 license.
- Fork the project on Github.
- Make your feature addition or fix bug, write tests and commit.
- Create a pull request with one of maintainer's as Reviewers.