Add logstash publisher

The logstash publisher sends the build log to Logstash via Redis or
RabbitMQ

Change-Id: I85bfc9c4a70cd4ced79bdb29f95ee6b514b72e4f
This commit is contained in:
Richard Pijnenburg 2015-05-14 15:49:58 +02:00
parent 2d09702c8a
commit 667ff88967
6 changed files with 55 additions and 0 deletions

View File

@ -4299,6 +4299,36 @@ def gatling(parser, xml_parent, data):
XML.SubElement(gatling, 'enabled').text = 'true'
def logstash(parser, xml_parent, data):
"""yaml: logstash
Send job's console log to Logstash for processing and analyis of
your job data. Also stores test metrics from Junit.
Requires the Jenkins :jenkins-wiki:`Logstash Plugin <Logstash+Plugin>`.
:arg num max-lines: The maximum number of log lines to send to Logstash.
( default 1000 )
:arg bool fail-build: Mark build as failed if this step fails.
( default false )
Minimal Example:
.. literalinclude:: /../../tests/publishers/fixtures/logstash-min.yaml
Full Example:
.. literalinclude:: /../../tests/publishers/fixtures/logstash-full.yaml
"""
logstash = XML.SubElement(xml_parent,
'jenkins.plugins.logstash.LogstashNotifier')
XML.SubElement(logstash, 'maxLines').text = str(
data.get('max-lines', 1000))
XML.SubElement(logstash, 'failBuild').text = str(
data.get('fail-build', False))
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -169,6 +169,7 @@ jenkins_jobs.publishers =
join-trigger=jenkins_jobs.modules.publishers:join_trigger
junit=jenkins_jobs.modules.publishers:junit
logparser=jenkins_jobs.modules.publishers:logparser
logstash=jenkins_jobs.modules.publishers:logstash
maven-deploy=jenkins_jobs.modules.publishers:maven_deploy
performance=jenkins_jobs.modules.publishers:performance
pipeline=jenkins_jobs.modules.publishers:pipeline

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.logstash.LogstashNotifier>
<maxLines>2000</maxLines>
<failBuild>True</failBuild>
</jenkins.plugins.logstash.LogstashNotifier>
</publishers>
</project>

View File

@ -0,0 +1,4 @@
publishers:
- logstash:
max-lines: 2000
fail-build: true

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.logstash.LogstashNotifier>
<maxLines>1000</maxLines>
<failBuild>False</failBuild>
</jenkins.plugins.logstash.LogstashNotifier>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- logstash