diff --git a/manifests/site.pp b/manifests/site.pp index a550d72bf0..94116a67f6 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -460,6 +460,9 @@ node /^logstash-worker\d+\.openstack\.org$/ { class { 'openstack_project::logstash_worker': discover_node => 'elasticsearch02.openstack.org', + enable_mqtt => true, + mqtt_password => hiera('mqtt_service_user_password'), + mqtt_ca_cert_contents => hiera('mosquitto_tls_ca_file'), } } diff --git a/modules/openstack_project/manifests/logstash_worker.pp b/modules/openstack_project/manifests/logstash_worker.pp index 74ebcaa16f..a668f4628b 100644 --- a/modules/openstack_project/manifests/logstash_worker.pp +++ b/modules/openstack_project/manifests/logstash_worker.pp @@ -18,6 +18,13 @@ class openstack_project::logstash_worker ( $discover_node = 'elasticsearch01.openstack.org', $filter_rev = 'master', $filter_source = 'https://git.openstack.org/openstack-infra/logstash-filters', + $enable_mqtt = false, + $mqtt_hostname = 'firehose.openstack.org', + $mqtt_port = 8883, + $mqtt_topic = "logstash/${::hostname}", + $mqtt_username = 'infra', + $mqtt_password = undef, + $mqtt_ca_cert_contents = undef, ) { file { '/etc/default/logstash-indexer': ensure => present, @@ -47,9 +54,11 @@ class openstack_project::logstash_worker ( } class { '::logstash::indexer': - input_template => 'openstack_project/logstash/input.conf.erb', - output_template => 'openstack_project/logstash/output.conf.erb', - require => Logstash::Filter['openstack-logstash-filters'], + input_template => 'openstack_project/logstash/input.conf.erb', + output_template => 'openstack_project/logstash/output.conf.erb', + enable_mqtt => $enable_mqtt, + mqtt_ca_cert_contents => $mqtt_ca_cert_contents, + require => Logstash::Filter['openstack-logstash-filters'], } include ::log_processor diff --git a/modules/openstack_project/templates/logstash/output.conf.erb b/modules/openstack_project/templates/logstash/output.conf.erb index d189ccfeac..3f17ca70e4 100644 --- a/modules/openstack_project/templates/logstash/output.conf.erb +++ b/modules/openstack_project/templates/logstash/output.conf.erb @@ -4,4 +4,16 @@ output { manage_template => false flush_size => 1024 } +<% if @enable_mqtt -%> + mqtt { + host => <%= @mqtt_hostname %> + port => <%= @mqtt_port %> + topic => <%= @mqtt_topic %> + username => <%= @mqtt_username %> + password => <%= @mqtt_password %> + ssl => true + ca_file => "/etc/logstash/mqtt-root-CA.crt" + } +<% end -%> + }