Filippo Giunchedi has submitted this change and it was merged.

Change subject: base: support for multiple syslog hosts
......................................................................


base: support for multiple syslog hosts

Bug: T138073
Change-Id: I59113d1d4a19218d6c67fd1f38790fd4eee9ca37
---
M hieradata/common/base/remote_syslog.yaml
M hieradata/labs/deployment-prep/common.yaml
M modules/base/manifests/remote_syslog.pp
M modules/base/templates/remote_syslog.conf.erb
4 files changed, 14 insertions(+), 9 deletions(-)

Approvals:
  Filippo Giunchedi: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/common/base/remote_syslog.yaml 
b/hieradata/common/base/remote_syslog.yaml
index 6ab1046..0e829de 100644
--- a/hieradata/common/base/remote_syslog.yaml
+++ b/hieradata/common/base/remote_syslog.yaml
@@ -1,3 +1,4 @@
 ---
 enable: true
-central_host: syslog.eqiad.wmnet
+central_hosts:
+  - syslog.eqiad.wmnet
diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index 3b6a437..c576fb7 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -1,6 +1,7 @@
 ---
 base::remote_syslog::enable: true
-base::remote_syslog::central_host: 
"deployment-logstash2.deployment-prep.eqiad.wmflabs:10514"
+base::remote_syslog::central_hosts:
+  - "deployment-logstash2.deployment-prep.eqiad.wmflabs:10514"
 "ocg::temp_dir": /mnt/tmpfs
 "ocg::redis_host": deployment-redis01.deployment-prep.eqiad.wmflabs
 "ocg::statsd_host": labmon1001.eqiad.wmnet
diff --git a/modules/base/manifests/remote_syslog.pp 
b/modules/base/manifests/remote_syslog.pp
index b6ee691..667ba5a 100644
--- a/modules/base/manifests/remote_syslog.pp
+++ b/modules/base/manifests/remote_syslog.pp
@@ -7,18 +7,18 @@
 # [*enable*]
 #   Enable log forwarding. Should be set to false on the central server.
 #
-# [*central_host*]
-#   Host (and optional port) to forward syslog events to.
-#   (e.g. "syslog.eqiad.wmnet" or 
"deployment-logstash2.deployment-prep.eqiad.wmflabs:10514")
+# [*central_hosts*]
+#   A list of host (and optional port) to forward syslog events to.
+#   (e.g. ["syslog.eqiad.wmnet"] or 
["deployment-logstash2.deployment-prep.eqiad.wmflabs:10514"])
 #
 #
 class base::remote_syslog (
     $enable,
-    $central_host = undef,
+    $central_hosts = [],
 ) {
     if $enable {
-        if $central_host == undef {
-            fail('::base::remote_syslog::central_host required')
+        if empty($central_hosts) {
+            fail('::base::remote_syslog::central_hosts required')
         }
 
         rsyslog::conf { 'remote_syslog':
diff --git a/modules/base/templates/remote_syslog.conf.erb 
b/modules/base/templates/remote_syslog.conf.erb
index 27adc59..1751668 100644
--- a/modules/base/templates/remote_syslog.conf.erb
+++ b/modules/base/templates/remote_syslog.conf.erb
@@ -6,4 +6,7 @@
 # See also: 
http://www.rsyslog.com/sende-messages-with-tags-larger-than-32-characters/
 
 $template LongTagForwardFormat,"<%%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% 
%syslogtag%%msg:::sp-if-no-1st-sp%%msg%"
-*.info;mail.none;authpriv.none;cron.none @<%= @central_host 
%>;LongTagForwardFormat
+
+<% @central_hosts.sort.each do |log_host| %>
+*.info;mail.none;authpriv.none;cron.none @<%= log_host %>;LongTagForwardFormat
+<% end %>

-- 
To view, visit https://gerrit.wikimedia.org/r/306442
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I59113d1d4a19218d6c67fd1f38790fd4eee9ca37
Gerrit-PatchSet: 8
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to