fluent-plugin-numeric-counter 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/fluent-plugin-numeric-counter.gemspec +2 -1
- data/lib/fluent/plugin/out_numeric_counter.rb +50 -16
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eca30c0960083f2d09de2e87ad573a3afe28a9a
|
4
|
+
data.tar.gz: db747780c5031f6e2b4af01724379f863f6ba320
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f37489d5f5a06fe67fc66ceab08b3e5648b48243c124fda7f7931d07b84e892972b426a230772c1ccfea8739cea87fb5f2a201fe48671989b8249d306dce897
|
7
|
+
data.tar.gz: 44ad33100faae45ab3fdd0ddd89d0c90875d2b5bda87dc2bfc5e06f24f2666c0e35707b33b562fbb38177079900603ae2e7f600feff03a7bf47591e59b00715e
|
data/.travis.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "fluent-plugin-numeric-counter"
|
5
|
-
gem.version = "0.2.
|
5
|
+
gem.version = "0.2.3"
|
6
6
|
gem.authors = ["TAGOMORI Satoshi"]
|
7
7
|
gem.email = ["tagomoris@gmail.com"]
|
8
8
|
gem.description = %q{Counts messages, with specified key and numeric value in specified range}
|
@@ -17,5 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.add_development_dependency "rake"
|
19
19
|
gem.add_development_dependency "delorean"
|
20
|
+
gem.add_development_dependency "test-unit", ">= 3.1.0"
|
20
21
|
gem.add_runtime_dependency "fluentd"
|
21
22
|
end
|
@@ -8,23 +8,52 @@ class Fluent::NumericCounterOutput < Fluent::Output
|
|
8
8
|
|
9
9
|
PATTERN_MAX_NUM = 20
|
10
10
|
|
11
|
-
config_param :count_interval, :time, :default => 60
|
12
|
-
|
13
|
-
config_param :
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
config_param :
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
config_param :count_interval, :time, :default => 60,
|
12
|
+
:desc => 'The interval time to count in seconds.'
|
13
|
+
config_param :unit, :string, :default => nil,
|
14
|
+
:desc => <<-DESC
|
15
|
+
The interval time to monitor specified an unit (either of minute, hour, or day).
|
16
|
+
Use either of count_interval or unit.
|
17
|
+
DESC
|
18
|
+
config_param :output_per_tag, :bool, :default => false,
|
19
|
+
:desc => <<-DESC
|
20
|
+
Emit for each input tag.
|
21
|
+
tag_prefix must be specified together.
|
22
|
+
DESC
|
23
|
+
config_param :aggregate, :string, :default => 'tag',
|
24
|
+
:desc => 'Calculate in each input tag separetely, or all records in a mass.'
|
25
|
+
config_param :tag, :string, :default => 'numcount',
|
26
|
+
:desc => 'The output tag.'
|
27
|
+
config_param :tag_prefix, :string, :default => nil,
|
28
|
+
:desc => <<-DESC
|
29
|
+
The prefix string which will be added to the input tag.
|
30
|
+
output_per_tag yes must be specified together.
|
31
|
+
DESC
|
32
|
+
config_param :input_tag_remove_prefix, :string, :default => nil,
|
33
|
+
:desc => 'The prefix string which will be removed from the input tag.'
|
34
|
+
config_param :count_key, :string,
|
35
|
+
:desc => 'The key to count in the event record.'
|
36
|
+
config_param :outcast_unmatched, :bool, :default => false,
|
37
|
+
:desc => <<-DESC
|
38
|
+
Specify yes if you do not want to include 'unmatched' counts into percentage.
|
39
|
+
DESC
|
40
|
+
config_param :output_messages, :bool, :default => false,
|
41
|
+
:desc => 'Specify yes if you want to get tested messages.'
|
42
|
+
config_param :store_file, :string, :default => nil,
|
43
|
+
:desc => <<-DESC
|
44
|
+
Store internal data into a file of the given path on shutdown, and load on starting.
|
45
|
+
DESC
|
22
46
|
|
23
47
|
# pattern0 reserved as unmatched counts
|
24
|
-
config_param :pattern1, :string
|
25
|
-
|
48
|
+
config_param :pattern1, :string,
|
49
|
+
:desc => <<-DESC
|
50
|
+
string: NAME LOW HIGH
|
51
|
+
LOW/HIGH allows size prefix (ex: 10k, 5M, 3500G)
|
52
|
+
Note that pattern0 reserved as unmatched counts.
|
53
|
+
DESC
|
26
54
|
(2..PATTERN_MAX_NUM).each do |i|
|
27
|
-
config_param ('pattern' + i.to_s).to_sym, :string, :default => nil
|
55
|
+
config_param ('pattern' + i.to_s).to_sym, :string, :default => nil,
|
56
|
+
:desc => 'string: NAME LOW HIGH'
|
28
57
|
end
|
29
58
|
|
30
59
|
attr_accessor :counts
|
@@ -38,6 +67,11 @@ class Fluent::NumericCounterOutput < Fluent::Output
|
|
38
67
|
define_method("log") { $log }
|
39
68
|
end
|
40
69
|
|
70
|
+
# Define `router` method of v0.12 to support v0.10.57 or earlier
|
71
|
+
unless method_defined?(:router)
|
72
|
+
define_method("router") { Fluent::Engine }
|
73
|
+
end
|
74
|
+
|
41
75
|
def parse_num(str)
|
42
76
|
if str.nil?
|
43
77
|
nil
|
@@ -224,12 +258,12 @@ class Fluent::NumericCounterOutput < Fluent::Output
|
|
224
258
|
if @output_per_tag
|
225
259
|
time = Fluent::Engine.now
|
226
260
|
flush_per_tags(step).each do |tag,message|
|
227
|
-
|
261
|
+
router.emit(@tag_prefix_string + tag, time, message)
|
228
262
|
end
|
229
263
|
else
|
230
264
|
message = flush(step)
|
231
265
|
if message.keys.size > 0
|
232
|
-
|
266
|
+
router.emit(@tag, Fluent::Engine.now, message)
|
233
267
|
end
|
234
268
|
end
|
235
269
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-numeric-counter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.1.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.1.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: fluentd
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,10 +103,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
103
|
version: '0'
|
90
104
|
requirements: []
|
91
105
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.4.5
|
93
107
|
signing_key:
|
94
108
|
specification_version: 4
|
95
109
|
summary: Fluentd plugin to count messages with specified numeric values
|
96
110
|
test_files:
|
97
111
|
- test/helper.rb
|
98
112
|
- test/plugin/test_out_numeric_counter.rb
|
113
|
+
has_rdoc:
|