fluent-plugin-grepcounter 0.5.0 → 0.5.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +9 -22
- data/fluent-plugin-grepcounter.gemspec +1 -2
- data/lib/fluent/plugin/out_grepcounter.rb +1 -2
- data/spec/out_grepcounter_spec.rb +9 -24
- 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: 325a34b1806a1a3513714f45dcda6108b12557cf
|
4
|
+
data.tar.gz: 91bd55d9a23ed982b33374d85e0c82dac847f950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b1bb4b4fddc06f4ee13740dee2e3b4a930c96221946fc9d36b68b2efb3c77b9dce7571b0cc678621cbb60f5f4e45382de848fcf23db51b020d68c078aa7eb7
|
7
|
+
data.tar.gz: b627c1fccda47489e1f59f9a84c35c65b8370af1930eaf71fbf40b63e0332c7ce13265d2c92406a69a98c450b61a87f73389a33d7243ebaa95429917bf34f348
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -77,42 +77,33 @@ Then, output bocomes as belows (indented). You can see the `message` field is jo
|
|
77
77
|
|
78
78
|
- regexp[1-20] *field\_key* *regexp* (experimental)
|
79
79
|
|
80
|
-
The target field key and the filtering regular expression to grep out.
|
80
|
+
The target field key and the filtering regular expression to grep out. No `message` is outputted in this case.
|
81
81
|
|
82
82
|
- exclude[1-20] *field_key* *regexp* (experimental)
|
83
83
|
|
84
|
-
The target field key and the excluding regular expression like grep -v
|
84
|
+
The target field key and the excluding regular expression like grep -v. No `message` is outputted in this case.
|
85
85
|
|
86
86
|
- threshold
|
87
87
|
|
88
88
|
The threshold number to emit. Emit if `count` value >= specified value.
|
89
89
|
|
90
|
-
-
|
91
|
-
|
92
|
-
The comparation operator for the threshold (either of `>=` or `<=`). Default is `>=`, i.e., emit if count >= threshold.
|
93
|
-
NOTE: 0 count message will not be emitted even if `<=` is specified because standby nodes receive no message usually.
|
94
|
-
|
95
|
-
- greater\_equal (from 0.2.0)
|
90
|
+
- greater\_equal
|
96
91
|
|
97
92
|
This is same with `threshold` option. Emit if `count` value is greater than or equal to (>=) specified value.
|
98
93
|
|
99
|
-
- greater\_than
|
94
|
+
- greater\_than
|
100
95
|
|
101
96
|
Emit if `count` value is greater than (>) specified value.
|
102
97
|
|
103
|
-
- less\_than
|
98
|
+
- less\_than
|
104
99
|
|
105
100
|
Emit if `count` value is less than (<) specified value.
|
106
101
|
|
107
|
-
- less\_equal
|
102
|
+
- less\_equal
|
108
103
|
|
109
104
|
Emit if `count` value is less than or equal to (<=) specified value.
|
110
105
|
|
111
|
-
-
|
112
|
-
|
113
|
-
The output tag. Required for aggregate `all`.
|
114
|
-
|
115
|
-
- tag (from 0.4.0)
|
106
|
+
- tag
|
116
107
|
|
117
108
|
The output tag. Required for aggregate `all`.
|
118
109
|
|
@@ -120,15 +111,11 @@ Then, output bocomes as belows (indented). You can see the `message` field is jo
|
|
120
111
|
|
121
112
|
Add tag prefix for output message
|
122
113
|
|
123
|
-
- remove\_tag\_prefix
|
114
|
+
- remove\_tag\_prefix
|
124
115
|
|
125
116
|
Remove tag prefix for output message
|
126
117
|
|
127
|
-
-
|
128
|
-
|
129
|
-
Output matched messages after `join`ed with the specified delimiter.
|
130
|
-
|
131
|
-
- delimiter (from 0.4.0)
|
118
|
+
- delimiter
|
132
119
|
|
133
120
|
Output matched messages after `join`ed with the specified delimiter.
|
134
121
|
|
@@ -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-grepcounter"
|
6
|
-
s.version = "0.5.
|
6
|
+
s.version = "0.5.1"
|
7
7
|
s.authors = ["Naotoshi Seo"]
|
8
8
|
s.email = ["sonots@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/sonots/fluent-plugin-grepcounter"
|
@@ -23,5 +23,4 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency "rspec"
|
24
24
|
s.add_development_dependency "pry"
|
25
25
|
s.add_development_dependency "pry-nav"
|
26
|
-
# s.add_development_dependency "delorean"
|
27
26
|
end
|
@@ -231,8 +231,7 @@ class Fluent::GrepCounterOutput < Fluent::Output
|
|
231
231
|
if @input_key
|
232
232
|
output['message'] = @delimiter ? matches.join(@delimiter) : matches
|
233
233
|
else
|
234
|
-
#
|
235
|
-
output['message'] = @delimiter ? matches.map{|hash| hash.to_hash}.join(@delimiter) : matches
|
234
|
+
# no 'message' field in the case of regexpN and excludeN
|
236
235
|
end
|
237
236
|
if tag
|
238
237
|
output['input_tag'] = tag
|
@@ -8,6 +8,12 @@ class Fluent::Test::OutputTestDriver
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
class Hash
|
12
|
+
def delete!(key)
|
13
|
+
self.tap {|h| h.delete(key) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
11
17
|
describe Fluent::GrepCounterOutput do
|
12
18
|
before { Fluent::Test.setup }
|
13
19
|
CONFIG = %[
|
@@ -115,12 +121,7 @@ describe Fluent::GrepCounterOutput do
|
|
115
121
|
Fluent::Engine.stub(:now).and_return(time)
|
116
122
|
Fluent::Engine.should_receive(:emit).with("count.#{tag}", time, expected.merge({
|
117
123
|
"count"=>3,
|
118
|
-
|
119
|
-
{"message"=>"2013/01/13T07:02:13.232645 WARN POST /auth"},
|
120
|
-
{"message"=>"2013/01/13T07:02:21.542145 WARN GET /favicon.ico"},
|
121
|
-
{"message"=>"2013/01/13T07:02:43.632145 WARN POST /login"},
|
122
|
-
],
|
123
|
-
}))
|
124
|
+
}).delete!('message'))
|
124
125
|
end
|
125
126
|
it { emit }
|
126
127
|
end
|
@@ -146,11 +147,7 @@ describe Fluent::GrepCounterOutput do
|
|
146
147
|
Fluent::Engine.stub(:now).and_return(time)
|
147
148
|
Fluent::Engine.should_receive(:emit).with("count.#{tag}", time, expected.merge({
|
148
149
|
"count"=>2,
|
149
|
-
|
150
|
-
{"message"=>"2013/01/13T07:02:13.232645 WARN POST /auth"},
|
151
|
-
{"message"=>"2013/01/13T07:02:43.632145 WARN POST /login"},
|
152
|
-
],
|
153
|
-
}))
|
150
|
+
}).delete!('message'))
|
154
151
|
end
|
155
152
|
it { emit }
|
156
153
|
end
|
@@ -332,7 +329,7 @@ describe Fluent::GrepCounterOutput do
|
|
332
329
|
it { emit }
|
333
330
|
end
|
334
331
|
|
335
|
-
context 'delimiter
|
332
|
+
context 'delimiter' do
|
336
333
|
# \\n shall be \n in config file
|
337
334
|
let(:config) { CONFIG + %[delimiter \\n] }
|
338
335
|
before do
|
@@ -343,18 +340,6 @@ describe Fluent::GrepCounterOutput do
|
|
343
340
|
it { emit }
|
344
341
|
end
|
345
342
|
|
346
|
-
context 'delimiter for new style (regexpN or excludeN)' do
|
347
|
-
# \\n shall be \n in config file
|
348
|
-
let(:config) { %[regexp1 message .\ndelimiter \\n] }
|
349
|
-
before do
|
350
|
-
Fluent::Engine.stub(:now).and_return(time)
|
351
|
-
# I will think of good format later ...
|
352
|
-
message = "{\"message\"=>\"2013/01/13T07:02:11.124202 INFO GET /ping\"}\\n{\"message\"=>\"2013/01/13T07:02:13.232645 WARN POST /auth\"}\\n{\"message\"=>\"2013/01/13T07:02:21.542145 WARN GET /favicon.ico\"}\\n{\"message\"=>\"2013/01/13T07:02:43.632145 WARN POST /login\"}"
|
353
|
-
Fluent::Engine.should_receive(:emit).with("count.#{tag}", time, expected.merge("message" => message))
|
354
|
-
end
|
355
|
-
it { emit }
|
356
|
-
end
|
357
|
-
|
358
343
|
context 'aggregate all' do
|
359
344
|
let(:messages) { ['foobar', 'foobar'] }
|
360
345
|
let(:emit) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-grepcounter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
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-
|
11
|
+
date: 2013-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|