WIP: Add mqtt output plugin to logstash indexers
Change-Id: I7255f6c256ab3e3ca33caf69b71bf4ffab02c1bb Depends-On: I8c4e4bb36352724f5e5856144038f2c478514df6
This commit is contained in:
parent
f671fcf2c9
commit
c07c3714ca
|
@ -31,6 +31,13 @@ class logstash::indexer (
|
|||
$conf_template = undef,
|
||||
$input_template = 'logstash/input.conf.erb',
|
||||
$output_template = 'logstash/output.conf.erb',
|
||||
$enable_mqtt = true,
|
||||
$mqtt_hostname = 'firehose.openstack.org',
|
||||
$mqtt_port = 8883,
|
||||
$mqtt_topic = "logstash-${servername}",
|
||||
$mqtt_certfile_contents = undef,
|
||||
$mqtt_key_file_contents = undef,
|
||||
$mqtt_ca_cert_contents = undef,
|
||||
) {
|
||||
include ::logstash
|
||||
|
||||
|
@ -84,7 +91,42 @@ class logstash::indexer (
|
|||
mode => '0644',
|
||||
require => Class['logstash'],
|
||||
}
|
||||
if $enable_mqtt {
|
||||
exec {'install_mqtt_plugin':
|
||||
command => 'bin/plugin install logstash-output-mqtt',
|
||||
before => Service['logstash']
|
||||
}
|
||||
|
||||
file { '/etc/logstash/mqtt_cert.pem.crt':
|
||||
ensure => present,
|
||||
content => $mqtt_certfile_contents,
|
||||
replace => true,
|
||||
owner => 'logstash',
|
||||
group => 'logstash',
|
||||
mode => '0600',
|
||||
before => Service['logstash']
|
||||
}
|
||||
|
||||
file { '/etc/logstash/mqtt_private.pem.key':
|
||||
ensure => present,
|
||||
content => $mqtt_key_file_contents,
|
||||
replace => true,
|
||||
owner => 'logstash',
|
||||
group => 'logstash',
|
||||
mode => '0600',
|
||||
before => Service['logstash']
|
||||
}
|
||||
|
||||
file { '/etc/logstash/mqtt-root-CA.pem.crt':
|
||||
ensure => present,
|
||||
content => $mqtt_ca_cert_contents,
|
||||
replace => true,
|
||||
owner => 'logstash',
|
||||
group => 'logstash',
|
||||
mode => '0600',
|
||||
before => Service['logstash']
|
||||
}
|
||||
}
|
||||
service { 'logstash':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
|
|
|
@ -11,8 +11,21 @@ input {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
output {
|
||||
elasticsearch {
|
||||
host => "127.0.0.1"
|
||||
}
|
||||
<% if @enable_mqtt -%>
|
||||
mqtt {
|
||||
host => <%= @mqtt_host %>
|
||||
port => <%= @mqtt_port %>
|
||||
topic => <%= @mqtt_topic %>
|
||||
ssl => true
|
||||
cert_file => "/etc/logstash/mqtt_cert.pem.crt"
|
||||
key_file => "/etc/logstash/mqtt_private.pem.key"
|
||||
ca_file => "/etc/logastash/mqtt-root-CA.crt"
|
||||
}
|
||||
<% end -%>
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue