fluent-plugin-notifier 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-notifier"
4
- gem.version = "0.0.1"
4
+ gem.version = "0.0.2"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.summary = %q{check matched messages and emit alert message}
@@ -167,7 +167,7 @@ class Fluent::NotifierOutput < Fluent::Output
167
167
  class Definition
168
168
  attr_accessor :tag, :tag_warn, :tag_crit
169
169
  attr_accessor :intervals, :repetitions
170
- attr_accessor :pattern, :check, :target_keys, :target_key_pattern
170
+ attr_accessor :pattern, :check, :target_keys, :target_key_pattern, :exclude_keys, :exclude_key_pattern
171
171
  attr_accessor :crit_threshold, :warn_threshold # for 'numeric_upward', 'numeric_downward'
172
172
  attr_accessor :crit_regexp, :warn_regexp # for 'string_find'
173
173
 
@@ -195,8 +195,10 @@ class Fluent::NotifierOutput < Fluent::Output
195
195
  end
196
196
  when 'target_keys'
197
197
  @target_keys = element['target_keys'].split(',')
198
+ @exclude_keys = (element['exclude_keys'] || '').split(',')
198
199
  when 'target_key_pattern'
199
200
  @target_key_pattern = Regexp.compile(element['target_key_pattern'])
201
+ @exclude_key_pattern = Regexp.compile(element['exclude_key_pattern'] || '^$')
200
202
  end
201
203
  end
202
204
  if @pattern.nil? or @pattern.length < 1
@@ -220,7 +222,11 @@ class Fluent::NotifierOutput < Fluent::Output
220
222
  end
221
223
 
222
224
  def match?(key)
223
- (@target_keys and @target_keys.include?(key)) or (@target_key_pattern and @target_key_pattern.match(key))
225
+ if @target_keys
226
+ @target_keys.include?(key) and not @exclude_keys.include?(key)
227
+ elsif @target_key_pattern
228
+ @target_key_pattern.match(key) and not @exclude_key_pattern.match(key)
229
+ end
224
230
  end
225
231
 
226
232
  # {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-15 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd