Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263024

Change subject: logstash: add sentry output plugin
......................................................................

logstash: add sentry output plugin

Bug: T85239
Change-Id: I6b328e9606a9051ca914ea7df150a6ca0f7221fa
---
A modules/logstash/manifests/output/sentry.pp
A modules/logstash/templates/output/sentry.erb
2 files changed, 64 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/24/263024/1

diff --git a/modules/logstash/manifests/output/sentry.pp 
b/modules/logstash/manifests/output/sentry.pp
new file mode 100644
index 0000000..5298c5c
--- /dev/null
+++ b/modules/logstash/manifests/output/sentry.pp
@@ -0,0 +1,46 @@
+# == Define: logstash::output::sentry
+#
+# Configure logstash to output to Sentry.
+#
+# You can find the required parameters in the Sentry DSN, which looks like
+# http(s)://<key>:<secret>@<host>/<project_id>
+#
+# == Parameters:
+# - $ensure: Whether the config should exist. Default present.
+# - $host: Sentry server.
+# - $key: Sentry key.
+# - $secret: Sentry secret.
+# - $project_id: Sentry project ID.
+# - $use_ssl: Whether to use HTTPS (defaults to true).
+# - $msg: Sentry event title (defaults to "Message from logstash").
+# - $level_tag: Sentry severity level (defaults to 'error').
+# - $fields_to_tags: Whether to set logstash fields as extra fields
+#   in Sentry (defaults to true).
+#
+# == Sample usage:
+#
+#   logstash::output::sentry { 'sentry':
+#       host       => 'sentry-beta.wmflabs.org',
+#       key        => 'd047f51cfe7f413398762d25093936bc',
+#       secret     => '0f39f34792d04ef6b8da025f07a3bac1'
+#       project_id => '2',
+#   }
+#
+define logstash::output::sentry(
+    $ensure         = present,
+    $host,
+    $key,
+    $secret,
+    $project_id,
+    $use_ssl        = true,
+    $msg            = undef,
+    $level_tag      = undef,
+    $fields_to_tags = true,
+) {
+    logstash::conf { "output-sentry-${title}":
+        ensure   => $ensure,
+        content  => template('logstash/output/sentry.erb'),
+        priority => $priority,
+    }
+}
+# vim:sw=4 ts=4 sts=4 et:
diff --git a/modules/logstash/templates/output/sentry.erb 
b/modules/logstash/templates/output/sentry.erb
new file mode 100644
index 0000000..ec95a07
--- /dev/null
+++ b/modules/logstash/templates/output/sentry.erb
@@ -0,0 +1,18 @@
+output {
+    sentry {
+        host           => "<%= @host %>"
+        key            => "<%= @key %>"
+        secret         => "<%= @secret %>"
+        project_id     => "<%= @project_id %>"
+        use_ssl        =>  <%= @use_ssl %>
+    <% if @msg %>
+        msg            => "<%= @msg %>"
+    <% end %>
+    <% if @level_tag %>
+        level_tag      => "<%= @level_tag %>"
+    <% end %>
+    <% if @fields_to_tags %>
+        fields_to_tags =>  <%= @fields_to_tags %>
+    <% end %>
+    }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b328e9606a9051ca914ea7df150a6ca0f7221fa
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

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

Reply via email to