fluent-plugin-sentry-rubrik 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -1
- data/fluent-plugin-sentry.gemspec +1 -1
- data/lib/fluent/plugin/out_sentry.rb +24 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d735c9999a2f9e07c45e99ba034ede076f5663
|
4
|
+
data.tar.gz: '0078205ce40f7a2be3ab3991b0bc50f5546b944b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a604a680cfa1a20aac1f3d7cc1580c88d2943d00fd5491282e6561d912fcaeab8308ba324daf050bbe5cfb0124f493e296b6d4d6f10265829b0fb79abaa214e4
|
7
|
+
data.tar.gz: 6ff5045f7003416dfb91a40e7ed14333c8f34e47fed412c3505d7524496f1c10dcd4bea1def7aa7d48e49aba92494d014820262ad5f5e606418659187ab815e4
|
data/README.md
CHANGED
@@ -93,7 +93,7 @@ Note that the default ignores `info` and `debug` logs. And `default_level`
|
|
93
93
|
defaults to `info`. This might ignore more logs than you anticipated.
|
94
94
|
|
95
95
|
* tags_key
|
96
|
-
[default] ""
|
96
|
+
[default] "" (empty array)
|
97
97
|
|
98
98
|
Report those items with the given key as tags to Sentry. This makes it possible
|
99
99
|
to correlate events via tags. Access to structured tag is supported, for
|
@@ -114,6 +114,22 @@ example and `\t` instead of a visual tabulation.
|
|
114
114
|
When true (the default) this option will expand the escaped character into the
|
115
115
|
original control code. This important for successfully parsing stacktraces.
|
116
116
|
|
117
|
+
* userid_key
|
118
|
+
[default] "" (empty array)
|
119
|
+
|
120
|
+
List of keys to use as for the Sentry user id. Keys are looked up in order a
|
121
|
+
log event, first match wins.
|
122
|
+
|
123
|
+
Example with `userid_key account, user` and the log
|
124
|
+
`{ "msg": "foo", "account": "foo", "user": "babar" }` the Sentry user id will
|
125
|
+
be set to "foo".
|
126
|
+
|
127
|
+
Composed IDs are supported. Example with
|
128
|
+
`userid_key account/user, account, user` and the log as above, the Sentry user
|
129
|
+
id will be set to "foo/babar".
|
130
|
+
|
131
|
+
Forward slash is used to identify the different keys.
|
132
|
+
|
117
133
|
It also support rewriting Tag with SetTagKeyMixin.
|
118
134
|
|
119
135
|
* remove_tag_prefix
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-sentry-rubrik"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.14"
|
8
8
|
spec.authors = ["Kentaro Yoshida", "François-Xavier Bourlet"]
|
9
9
|
spec.email = ["y.ken.studio@gmail.com", "fx.bourlet@rubrik.com"]
|
10
10
|
spec.summary = %q{Fluentd output plugin that sends aggregated errors/exception events to Sentry. Sentry is a event logging and aggregation platform.}
|
@@ -17,6 +17,7 @@ module Fluent
|
|
17
17
|
config_param :default_logger, :string, :default => 'fluentd'
|
18
18
|
config_param :report_levels, :array, value_type: :string, :default => %w(fatal error warn warning)
|
19
19
|
config_param :tags_key, :array, value_type: :string, :default => %w()
|
20
|
+
config_param :userid_key, :array, value_type: :string, :default => %w()
|
20
21
|
config_param :endpoint_url, :string
|
21
22
|
config_param :flush_interval, :time, :default => 0
|
22
23
|
config_param :hostname_command, :string, :default => 'hostname'
|
@@ -42,6 +43,14 @@ module Fluent
|
|
42
43
|
|
43
44
|
@tags_key = @tags_key.to_set()
|
44
45
|
|
46
|
+
@userid_key_patterns = []
|
47
|
+
@userid_key.each do |key_pattern|
|
48
|
+
keys = key_pattern.split("/")
|
49
|
+
@userid_key_patterns.push(keys)
|
50
|
+
end
|
51
|
+
|
52
|
+
$log.info(@userid_key_patterns)
|
53
|
+
|
45
54
|
hostname_command = @hostname_command || DEFAULT_HOSTNAME_COMMAND
|
46
55
|
@hostname = `#{hostname_command}`.chomp
|
47
56
|
|
@@ -106,6 +115,12 @@ module Fluent
|
|
106
115
|
|
107
116
|
event.tags = event.tags.merge(extract_tags(record))
|
108
117
|
event.extra = record.reject{ |key| EVENT_KEYS.include?(key) }
|
118
|
+
|
119
|
+
user_id = extract_userid(record)
|
120
|
+
if user_id != nil
|
121
|
+
event.user = {"id": user_id}
|
122
|
+
end
|
123
|
+
|
109
124
|
@client.send_event(event)
|
110
125
|
end
|
111
126
|
|
@@ -123,5 +138,14 @@ module Fluent
|
|
123
138
|
}
|
124
139
|
return r
|
125
140
|
end
|
141
|
+
|
142
|
+
def extract_userid(record)
|
143
|
+
@userid_key_patterns.each do |pattern|
|
144
|
+
values = pattern.each.map do |key| record[key] end
|
145
|
+
if values.all?
|
146
|
+
return values.join("/")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
126
150
|
end
|
127
151
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-sentry-rubrik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Yoshida
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|