logstash-output-sentry 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b4b6f3febff467476f1bda31a0553447d425348
4
- data.tar.gz: 8ae6985516d7982465dbd4f9892115ea3e44cca6
3
+ metadata.gz: f0167aa85d7256913ed5f26cdbde6afbc1d648be
4
+ data.tar.gz: 996a962f3f97b93a15c0d7fa0849c32e8a8664ca
5
5
  SHA512:
6
- metadata.gz: 762fbb64d456fa1236e979f599ec45c59391e39aacca9741a0bda7406655e8b3057fbbb0bb9a8d92cae283b8ca0cfb12f7ea06a8fe06085587c37c3682733c2c
7
- data.tar.gz: f2f5c3550935a4ba57386c75adf49ed1911dce630ba93a71ef08574a486ff8c056b6c0776b7d1dfddacb577a3a5b36be7795935820e84c6fd9d86d4231ce6a27
6
+ metadata.gz: 151cb70eca4b7fe7369ea09487a20bb1cc9a635570a2110b122d47c5996cd446e0eb65e0e498dcebcaddf0dac55b18fb6252aa4235e5ccc4342465ea0fde0eac
7
+ data.tar.gz: af27c9c7dd5f3afc467adae93237656696712519cbd9ea7b2eec387465db3a44d19693ca033b08844872d04c526a1e5c71c96dba070be08e1e0c39db66f49982
data/README.md CHANGED
@@ -21,12 +21,12 @@ As this plugin has been shared on [RubyGems](https://rubygems.org) with the name
21
21
  bin/plugin install logstash-output-sentry
22
22
  ```
23
23
 
24
- When installing from official repository as suggested below, the installation path is ```/opt/logstash```.
24
+ When installing from official repository as suggested below, the installation path is `/opt/logstash`.
25
25
 
26
26
  ### Usage
27
27
 
28
28
  [Sentry](https://getsentry.com/) is a modern error logging and aggregation platform.
29
- Its important to note that Sentry should not be thought of as a log stream, but as an aggregator.
29
+ It's important to note that Sentry should not be thought of as a log stream, but as an aggregator.
30
30
  It fits somewhere in-between a simple metrics solution (such as Graphite) and a full-on log stream aggregator (like Logstash).
31
31
 
32
32
  * In Sentry, generate and get your client key (Settings -> Client key). The client key has this form:
@@ -45,7 +45,7 @@ output {
45
45
  }
46
46
  ```
47
47
 
48
- * Note that all your fields (incluing the Logstash field "message") will be in the "extra" field in Sentry. But be careful : by default , the host is set to "app.getsentry.com". If you have installed Sentry on your own machine, please change the host (change "localhost:9000" with the correct value according your configuration):
48
+ * Note that all your fields (incluing the Logstash field `message`) will be in the `extra` field in Sentry. But be careful: by default, the `host` is set to `"app.getsentry.com"`. If you have installed Sentry on your own machine, please change the `host` (change "localhost:9000" with the correct value according your configuration):
49
49
  ```ruby
50
50
  output {
51
51
  sentry {
@@ -58,7 +58,7 @@ output {
58
58
  }
59
59
  ```
60
60
 
61
- * You can change the "message" field (default : "Message from logstash"), or optionally specify a field to use from your event. In case the message field doesn't exist, it'll be used as the actual message.
61
+ * You can change the `message` field (default: `"Message from logstash"`), or optionally specify a field to use from your event. In case the `message` field doesn't exist, it'll be used as the actual message.
62
62
  ```ruby
63
63
  sentry {
64
64
  'project_id' => "1"
@@ -68,7 +68,7 @@ sentry {
68
68
  }
69
69
  ```
70
70
 
71
- * You can indicate the level (default : "error"), and decide if all your Logstash fields will be tagged in Sentry. If you use the protocole HTTPS, please enable "use_ssl" (default : true), but if you use http you MUST disable ssl.
71
+ * You can indicate the level (default: `"error"`), and decide if all your Logstash fields will be tagged in Sentry. If you use the protocole HTTPS, please enable `use_ssl` (default: `true`), but if you use http you MUST disable SSL.
72
72
  ```ruby
73
73
  sentry {
74
74
  'host' => "192.168.56.102:9000"
@@ -82,7 +82,7 @@ sentry {
82
82
  }
83
83
  ```
84
84
 
85
- * You can optionally strip the timestamp from the sentry title by do setting `strip_timestamp` to `true`, which will change `YYYY-MM-DD HH:MM:SS,MILLISEC INFO ..` to `INFO ...`
85
+ * You can optionally strip the timestamp from the sentry title by setting `strip_timestamp` field to `true` (default: `false`), which will change `YYYY-MM-DD HH:MM:SS,MILLISEC INFO ..` to `INFO ...`
86
86
  ```ruby
87
87
  sentry {
88
88
  'host' => "192.168.56.102:9000"
@@ -62,6 +62,9 @@ class LogStash::Outputs::Sentry < LogStash::Outputs::Base
62
62
  # }
63
63
  config :fields_to_tags, :validate => :boolean, :default => false, :required => false
64
64
 
65
+ # Remove timestamp from message (title) if the message starts with a timestamp
66
+ config :strip_timestamp, :validate => :boolean, :default => false, :required => false
67
+
65
68
  public
66
69
  def register
67
70
  require 'net/https'
@@ -83,10 +86,18 @@ class LogStash::Outputs::Sentry < LogStash::Outputs::Base
83
86
 
84
87
  require 'securerandom'
85
88
 
89
+ #use message from event if exists, if not from static
90
+ message_to_send = event["#{msg}"] || "#{msg}"
91
+ if strip_timestamp
92
+ #remove timestamp from message if available
93
+ message_matched = message_to_send.match(/\d\d\d\d\-\d\d\-\d\d\s[0-9]{1,2}\:\d\d\:\d\d,\d{1,}\s(.*)/)
94
+ message_to_send = message_matched ? message_matched[1] : message_to_send
95
+ end
96
+
86
97
  packet = {
87
98
  :event_id => SecureRandom.uuid.gsub('-', ''),
88
99
  :timestamp => event['@timestamp'],
89
- :message => event['message'] || "#{msg}",
100
+ :message => message_to_send,
90
101
  :level => "#{level_tag}",
91
102
  :platform => 'logstash',
92
103
  :server_name => event['host'],
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-sentry'
3
- s.version = '0.2.0'
3
+ s.version = '0.3.0'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = 'This output plugin sends messages to any sentry server.'
6
6
  s.description = 'This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install logstash-output-sentry. This gem is not a stand-alone program.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-sentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Matos Odut