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!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...