fluent-plugin-grep 0.3.1 → 0.3.2

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: 08a91d586b4f1b69b5859a4b504d6f20a2dcb885
4
- data.tar.gz: 8b1e714a1fcc6121d1ea8b5cdbefb88b76866a67
3
+ metadata.gz: f8ed5698594f518f8856725be943ebe18632086e
4
+ data.tar.gz: c52945cd2644ff09ec8ca4ed71d3d4196fa76768
5
5
  SHA512:
6
- metadata.gz: 0abf3dd5a6c4638eb2d27d36435844a164c74f0fc94faf551aa24d8cbccc8b29fdfcb5c4bdec3d3aca71f959fa701b7224cbd2200ca9572e8ef1ad67c8dc1ca9
7
- data.tar.gz: c59f53e395fc5b0b14082c14452a977ac49e0ee925cfa32e3c99554c1e4d8a3c89d36c827d7c2e3e2ef08ef44302bcf8d0022522321494738227b02692d472fd
6
+ metadata.gz: e00ac4165583c2647cf00c1704b8bdc3d0913008ec7f0d2edc2f904b553b8b613770373df37b4575cfb9aeddfae467ac8f032b76d855bb96f2134df1804089e5
7
+ data.tar.gz: d45ed519f94552d0d84b76da994ef378021566065052e62f46932bc13223bb42b7c896938974c5fa95730b6a9f16fcf9ea570d4134e6226f4a5fd06ee8a900f0
data/.travis.yml CHANGED
@@ -4,3 +4,4 @@ rvm:
4
4
  - 2.0.0
5
5
  gemfile:
6
6
  - Gemfile
7
+ - Gemfile.fluentd.lt.0.10.43
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.3.2 (2014/02/04)
2
+
3
+ Enhancement:
4
+
5
+ - Support `log_level` option of Fleuntd v0.10.43
6
+
1
7
  ## 0.3.1 (2013/12/16)
2
8
 
3
9
  Changes:
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'simplecov', git: 'https://github.com/colszowka/simplecov.git'
4
3
  gemspec
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'fluentd', '= 0.10.42'
4
+ gemspec
data/README.md CHANGED
@@ -4,10 +4,13 @@ Fluentd plugin to grep messages.
4
4
 
5
5
  ## Configuration
6
6
 
7
+ ### Example 1:
8
+
7
9
  <match foo.bar.**>
8
10
  type grep
9
- regexp1 message WARN
10
- exclude1 message favicon
11
+ input_key message
12
+ regexp WARN
13
+ exclude favicon
11
14
  add_tag_prefix greped
12
15
  </source>
13
16
 
@@ -23,8 +26,43 @@ then output bocomes as belows (like, | grep WARN | grep -v favicon):
23
26
  greped.foo.bar: {"foo":"bar","message":"2013/01/13T07:02:13.232645 WARN POST /auth"}
24
27
  greped.foo.bar: {"foo":"bar","message":"2013/01/13T07:02:43.632145 WARN POST /login"}
25
28
 
29
+ ### Example 2:
30
+
31
+ Now, `regexpN` and `excludeN` options are available to specify grep conditions for *multiple* fields.
32
+
33
+ <match foo.bar.**>
34
+ type grep
35
+ regexp1 message WARN
36
+ regexp2 foo ^awesome$
37
+ exclude1 message favicon
38
+ add_tag_prefix greped
39
+ </source>
40
+
41
+ Assuming following inputs are coming:
42
+
43
+ foo.bar: {"foo":"bar","message":"2013/01/13T07:02:11.124202 INFO GET /ping"}
44
+ foo.bar: {"foo":"awesome","message":"2013/01/13T07:02:13.232645 WARN POST /auth"}
45
+ foo.bar: {"foo":"bar","message":"2013/01/13T07:02:21.542145 WARN GET /favicon.ico"}
46
+ foo.bar: {"foo":"bar","message":"2013/01/13T07:02:43.632145 WARN POST /login"}
47
+
48
+ then output bocomes as belows:
49
+
50
+ greped.foo.bar: {"foo":"awesome","message":"2013/01/13T07:02:13.232645 WARN POST /auth"}
51
+
26
52
  ## Parameters
27
53
 
54
+ - input\_key *field\_key*
55
+
56
+ The target field key to grep out. Use with regexp or exclude.
57
+
58
+ - regexp *regexp*
59
+
60
+ The filtering regular expression
61
+
62
+ - exclude *regexp*
63
+
64
+ The excluding regular expression like grep -v
65
+
28
66
  - regexp[1-20] *field\_key* *regexp*
29
67
 
30
68
  The target field key and the filtering regular expression to grep out.
@@ -49,18 +87,6 @@ then output bocomes as belows (like, | grep WARN | grep -v favicon):
49
87
 
50
88
  Replace invalid byte sequence in UTF-8 with '?' character if `true`
51
89
 
52
- - input\_key *field\_key* (obsolete)
53
-
54
- The target field key to grep out. Use with regexp or exclude.
55
-
56
- - regexp *regexp* (obsolete)
57
-
58
- The filtering regular expression
59
-
60
- - exclude *regexp* (obsolete)
61
-
62
- The excluding regular expression like grep -v
63
-
64
90
  ## ChangeLog
65
91
 
66
92
  See [CHANGELOG.md](CHANGELOG.md) for details.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-grep"
6
- s.version = "0.3.1"
6
+ s.version = "0.3.2"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-grep"
@@ -17,6 +17,11 @@ class Fluent::GrepOutput < Fluent::Output
17
17
  attr_reader :regexps
18
18
  attr_reader :excludes
19
19
 
20
+ # To support log_level option implemented by Fluentd v0.10.43
21
+ unless method_defined?(:log)
22
+ define_method("log") { $log }
23
+ end
24
+
20
25
  def configure(conf)
21
26
  super
22
27
 
@@ -77,8 +82,8 @@ class Fluent::GrepOutput < Fluent::Output
77
82
 
78
83
  chain.next
79
84
  rescue => e
80
- $log.warn e.message
81
- $log.warn e.backtrace.join(', ')
85
+ log.warn e.message
86
+ log.warn e.backtrace.join(', ')
82
87
  end
83
88
 
84
89
  private
@@ -236,4 +236,36 @@ describe Fluent::GrepOutput do
236
236
  it { emit }
237
237
  end
238
238
  end
239
+
240
+ describe 'test log' do
241
+ let(:log) { driver.instance.log }
242
+
243
+ def capture_log(log)
244
+ tmp = log.instance_variable_get(:@out)
245
+ out = StringIO.new
246
+ log.instance_variable_set(:@out, out)
247
+ yield log
248
+ return out.string
249
+ ensure
250
+ log.instance_variable_set(:@out, tmp)
251
+ end
252
+
253
+ if Fluent::VERSION >= "0.10.43"
254
+ context "log_level info" do
255
+ let(:config) { CONFIG + %[log_level info] }
256
+
257
+ it "should not contain debug level" do
258
+ capture_log(log) {|log| log.debug "foobar" }.should == ""
259
+ end
260
+ end
261
+ end
262
+
263
+ context "log" do
264
+ let(:config) { CONFIG }
265
+ it "should work" do
266
+ capture_log(log) {|log| log.info "foobar" }.should include("foobar")
267
+ end
268
+ end
269
+ end
270
+
239
271
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-grep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-15 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -108,6 +108,7 @@ files:
108
108
  - .travis.yml
109
109
  - CHANGELOG.md
110
110
  - Gemfile
111
+ - Gemfile.fluentd.lt.0.10.43
111
112
  - LICENSE
112
113
  - README.md
113
114
  - Rakefile