Add logstash publisher
The logstash publisher sends the build log to Logstash via Redis or RabbitMQ Change-Id: I85bfc9c4a70cd4ced79bdb29f95ee6b514b72e4f
This commit is contained in:
parent
2d09702c8a
commit
667ff88967
@ -4299,6 +4299,36 @@ def gatling(parser, xml_parent, data):
|
|||||||
XML.SubElement(gatling, 'enabled').text = 'true'
|
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):
|
class Publishers(jenkins_jobs.modules.base.Base):
|
||||||
sequence = 70
|
sequence = 70
|
||||||
|
|
||||||
|
@ -169,6 +169,7 @@ jenkins_jobs.publishers =
|
|||||||
join-trigger=jenkins_jobs.modules.publishers:join_trigger
|
join-trigger=jenkins_jobs.modules.publishers:join_trigger
|
||||||
junit=jenkins_jobs.modules.publishers:junit
|
junit=jenkins_jobs.modules.publishers:junit
|
||||||
logparser=jenkins_jobs.modules.publishers:logparser
|
logparser=jenkins_jobs.modules.publishers:logparser
|
||||||
|
logstash=jenkins_jobs.modules.publishers:logstash
|
||||||
maven-deploy=jenkins_jobs.modules.publishers:maven_deploy
|
maven-deploy=jenkins_jobs.modules.publishers:maven_deploy
|
||||||
performance=jenkins_jobs.modules.publishers:performance
|
performance=jenkins_jobs.modules.publishers:performance
|
||||||
pipeline=jenkins_jobs.modules.publishers:pipeline
|
pipeline=jenkins_jobs.modules.publishers:pipeline
|
||||||
|
9
tests/publishers/fixtures/logstash-full.xml
Normal file
9
tests/publishers/fixtures/logstash-full.xml
Normal 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>
|
4
tests/publishers/fixtures/logstash-full.yaml
Normal file
4
tests/publishers/fixtures/logstash-full.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
publishers:
|
||||||
|
- logstash:
|
||||||
|
max-lines: 2000
|
||||||
|
fail-build: true
|
9
tests/publishers/fixtures/logstash-min.xml
Normal file
9
tests/publishers/fixtures/logstash-min.xml
Normal 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>
|
2
tests/publishers/fixtures/logstash-min.yaml
Normal file
2
tests/publishers/fixtures/logstash-min.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
publishers:
|
||||||
|
- logstash
|
Loading…
Reference in New Issue
Block a user