Forward Jenkins build logs to logstash/elasticsearch using filebeat
Currently I am running filebeat as service on jenkins server and able to pass the log to logstash/ elasticsearch.
filebeat:
prospectors:
- paths:
- "/var/jenkins_home/jobs/*/builds/*/log"
output:
logstash:
hosts: ["172.22.0.4:5044"]
index: "jenkins"
Jenkins log file:
Started by user ha:////4Pt==anonymous
Building in workspace /var/jenkins_home/jobs/aaa/workspace
[workspace] $ /bin/sh -xe /tmp/jenkins2734923241755751652.sh
+ maven install
/tmp/jenkins2734923241755751652.sh: 2:
/tmp/jenkins2734923241755751652.sh: maven: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
- How do I send entire build log as single document. Currently it taking each log line as one row in elastricsearch.
- How do I add"Finished" as field in elastricsearch document.