Giter Site home page Giter Site logo

splunkforjenkins's Introduction

Splunk for Jenkins

To Install Develop Version

  • clone the repo
  • $ mvn package
  • That will generate splunk-devops/target/splunk-devops.hpi which you can install into Jenkins by the web interface or just put it in the JENKINS_HOME/plugins folder.
  • $ mvn clean verify -Dhost=localhost -Dusername=admin -Dpassword=changeme to run tests against local splunk instance

To Setup

Configure plugin

  • Go to https://jenkins-url/configure

  • Enter Hostname, Port, and Token

  • Enable RawEvent support if you are using Splunk version 6.3.1511 or later

  • Click "Test Connection" to verify the config

  • Enable it and Save

    Screenshot

Customize Job Data Sent to Splunk

Customize post job processing

  • In the advance configure section, you can customize the post data using groovy DSL
  • send(Object message) will send the information to splunk
  • AbstractBuild build, Map env can be used directly. Variable env is a Map of Environment variables, build is hudson.model.AbstractBuild
  • getBuildEvent() will return metadata about the build, such as build result, build URL, user who triggered the build
  • getJunitReport(int pageSize) will return a list of test results, which contains total, passes, failures, skips, time and testcase of type List<hudson.tasks.junit.CaseResult>
  • getJunitReport() is an alias of getJunitReport(Integer.MAX_VALUE)[0]
  • sendCoverageReport(pageSize) send coverage report, with pagination support
  • sendTestReport(pageSize) send Test report, with pagination support
  • archive(String includes, String excludes, boolean uploadFromSlave, String fileSizeLimit) send log file to splunk
  • archive(String includes) is an alias of archive(includes, null, false, "")
  • getAction(Class type) is an alias of build.getAction(type)
  • getActionByClassName(String className) same as getAction(Class type) but no need to import the class before use
  • hasPublisherName(String className) check whether the publisher is configured for the build (applied to AbstractBuild only)
  • Here is the default settings for post job data processing
//send job metadata and junit reports with page size set to 50 (each event contains max 50 test cases)
splunkins.sendTestReport(50)
//send coverage, each event contains max 50 class metrics
splunkins.sendCoverageReport(50)
//send all logs from workspace to splunk, with each file size limits to 10MB
splunkins.archive("**/*.log", null, false, "10MB")

Customize log files at job level

  • Add a "post-build action" called "Send data to Splunk"

  • Enter an ant-style pattern matching string for your junit xml collection

    Screenshot

Dashboard

you can get the "Splunk App for Jenkins" App from splunk base

System Requirement

You need enable "HTTP Event Collector" In Splunk to use the plugin, please checkout HTTP Event Collector

splunkforjenkins's People

Contributors

ctran avatar fengxx avatar kjotwani avatar ryanguest avatar splunk-djenkins avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.