The Coralogix Jenkins plugin facilitates the transmission of audit, security, and pipeline console logs to Coralogix, while pushing tags to the Coralogix platform.
Notes:
hpi
file from GitHub releaseshpi
file in the directory $JENKINS_HOME/plugins
Go to Manage Jenkins
, open Configure system
, find the Coralogix
section and configure your account Send-Your-Data API key for sending system/audit/security logs.
You can configure as many keys as you want.
Notes:
Coralogix Region
to Custom and overwrite it in Custom Coralogix endpoint
field. An example of a Custom Coralogix endpoint is private.coralogix.com
.Coralogix API endpoint
value by going to the Advanced
section and inserting:https://<cx_domain>
Before usage, create Jenkins credentials with your Coralogix Send-Your-Data API key for your team. Navigate to Manage Jenkins > Manage Credentials and click on Jenkins under Stores scoped to Jenkins.
Next, create a new credential of kind: Coralogix API key, this keys’ value is taken from: Data flow > API keys copy the “Alerts, Rules and Tags API Key” and insert it into the field.
This will allow us to use the “push tags” function since it will allow the creation of a tag each time there is a build in the pipe.
To push Tags, go under your config and click Add build step.
Select Push Tags to Coralogix and select the Tags key from your credentials.
This plugin supports sending build logs and tags for Freestyle project and Pipelines.
Send your build logs to Coralogix.
Freestyle project
Check Send build logs to Coralogix, select Private Key, and provide the Application and Subsystem names.
This is the Groovy implementation:
pipeline { agent any stages { stage('Test') { steps { echo "Hello world!" } } } post { always { coralogixSend privateKeyCredentialId: 'coralogix-production', application: 'MyApp', subsystem: "${env.JOB_NAME}", splitLogs: true } } }
It’s possible to use Curl command to create a log. Select the Coralogix [2] Logs Endpoint associated with your Coralogix domain.
curl --location --request POST '<endpoint>' \ --header 'private_key: <privatekey>' \ --header 'Content-Type: application/json' \ --data-raw '{"applicationName": "prd", "subsystemName": "app", "text": "hello world", "severity": "3"}'
Note: “text”, “severity” are optional fields.
Push version tag to Coralogix.
Freestyle project
Add build step Push Coralogix tag and configure:
This is the Groovy
representation of Push Coralogix tag
build step:
pipeline { agent any stages { stage('Test') { steps { echo "Hello world!" } } } post { success { coralogixTag apiKeyCredentialId: 'coralogix-production-api', tag: '1.0.0', applications: [ [name: 'MyApp'] ], subsystems: [ [name: 'staging'], [name: 'production'] ], icon: 'https://raw.githubusercontent.com/coralogix/jenkins-coralogix-plugin/master/docs/images/logo.svg' } } }
It’s possible to use Curl command to create a tag, choose the right Endpoint, add the “APIkey” and run the command below.
NOTE: “timestamp” and “iconUrl” are optional fields.
Domain | Endpoint |
coralogix.com | https://webapi.coralogix.com/api/v1/external/tags/ |
coralogix.us | https://webapi.coralogix.us/api/v1/external/tags/ |
coralogix.in | https://webapi.app.coralogix.in/api/v1/external/tags/ |
curl --location --request POST '<yourCoralogixEndpoint>' \ --header 'Authorization: Bearer <APIKey>' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "test tag", "timestamp": <currentTimeinMilliseconds> "application": ["prd", "dev"], "subsystem": ["app", "mobile"], "iconUrl": "<iconUrl>" }'
If upgrading from version <= 1.17, you will get an error in the Manage Jenkins UI:
To clear this error, simply click “Manage” and then “Discard Unreadable Data” of the CoralogixConfiguration:
The Coralogix Plugin is licensed under the Apache 2.0 License.
Need help?
Our world-class customer success team is available 24/7 to answer any questions that may come up. Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].