How to send build data to a Elasticsearch server

Article ID:360000864251
1 minute readKnowledge base


  • Is possible to send build data to an Elasticsearch server?


  • CloudBees Jenkins Enterprise - Managed controller (CJE-MM)

  • CloudBees Jenkins Enterprise - Operations center (CJE-OC)

  • Elesticsearch


Elasticsearch (ES) store documents into indices, so you need to create a index on ES, then you be able to send data through the REST API.

This command create a index named custom_builds in the ES server.


This command create a JSON file with some environment variables of the build, and send the data to the ES server. You could put this script in a shell step in a FreeStyle job or in a sh step in a Pipeline job.

cat > message.json <<EOF
"enviroment": "$ENV",
"build_number": "$BUILD_NUMBER",
"build_tag": "$BUILD_TAG",
"job_base_name": "$JOB_BASE_NAME",
"job_name": "$JOB_NAME",
"node_name": "$NODE_NAME",
"node_labels": "$NODE_LABELS",
"status": "SUCCESS",
"date": "$(date +%Y%m%d-%H:%M:%S)"

curl -u USERNAME:PASSWORD -XPUT '' -d '@message.json'

Tested product/plugin versions