All Apps and Add-ons

Splunk App for Jenkins: How to pass environment variables to Splunk

jonathan1234
Engager

Hello,

Does anybody know how to populate the "Environment Variables" section (found under the "Build Information" tab on the left) in the Splunk App for Jenkins? It's a scripted pipeline job. The "Build Summary" section (under the same "Build Information" tab) and "Logs and Artifacts" section are both populated.

I've reviewed the documentation on the Splunk Plugin for Jenkins page (https://wiki.jenkins.io/display/JENKINS/Splunk+Plugin+for+Jenkins) and the Splunk Plugin for Pipeline Job Support (https://wiki.jenkins.io/display/JENKINS/Splunk+Plugin+for+Pipeline+Job+Support) page but both are lacking in good documentation.

Thanks

0 Karma

jonathan1234
Engager

Well this is a huge pain. Splunk "can't" help as the app isn't officially supported. We ended up solving this issue by calling the the splunkins.send() method. See the Customize Event Processing Script section in the Splunk Plugin for Jenkins page. It provides a very basic example of how to manually send data to Splunk. There are probably better ways to achieve the same goal.

In our project, the splunkins.send() method is called from a shared library within a Jenkinsfile. The repos to include inside the POM can be found at MVNRepository.com.

0 Karma

jonathan1234
Engager

Links that didn't make it through:

Splunk Plugin for Jenkins - https://wiki.jenkins.io/display/JENKINS/Splunk+Plugin+for+Jenkins
MVNRepository.com - https://mvnrepository.com/artifact/com.splunk.splunkins

0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...