fluent-plugin-cat-sweep 0.1.2 → 0.1.3
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/.travis.yml +3 -1
- data/CHANGELOG.md +7 -0
- data/README.md +7 -1
- data/fluent-plugin-cat-sweep.gemspec +2 -2
- data/gemfiles/Gemfile.fluentd.0.10 +4 -0
- data/gemfiles/Gemfile.fluentd.0.10.45 +4 -0
- data/gemfiles/Gemfile.fluentd.0.12 +4 -0
- data/lib/fluent/plugin/in_cat_sweep.rb +54 -2
- data/test/helper.rb +10 -0
- data/test/test_in_cat_sweep.rb +21 -5
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a1bc310740299a8f62e3f801ba1715b5bbe7b6
|
4
|
+
data.tar.gz: 3d9b318ff11fc7f90ab805d7d10101dd93800555
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f74d5c1faf9b9f5190b58c219ed2d3c982a3779cb7d7d5fccc86637b1e000b718a420b97120bf37eaa61d2664bf1706cea693c469d99621229da170625802f8
|
7
|
+
data.tar.gz: 175666731ebeb4c8f7b1115b46f0437f7ccfafcca820d47beacd8cfa1e20bc5b20d4024eae3b6af471678192ef7c652d08390598e2b51c966fe36172ca9c7cd6
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# fluent-plugin-cat-sweep
|
2
2
|
|
3
|
-
[](http://travis-ci.org/civitaspo/fluent-plugin-cat-sweep)
|
4
4
|
|
5
5
|
Fluentd plugin to read data from files and to remove or move after processing.
|
6
6
|
|
@@ -93,6 +93,12 @@ Our assumption is that this mechanism should provide more durability than `in_ta
|
|
93
93
|
|
94
94
|
[CHANGELOG.md](CHANGELOG.md)
|
95
95
|
|
96
|
+
## Warning
|
97
|
+
|
98
|
+
* This plugin supports fluentd from v0.10.45
|
99
|
+
* The support for fluentd v0.10 will end near future
|
100
|
+
* The support for fluentd v0.14 is not yet
|
101
|
+
|
96
102
|
## Contributing
|
97
103
|
|
98
104
|
1. Fork it ( https://github.com/civitaspo/fluent-plugin-cat-sweep/fork )
|
@@ -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-cat-sweep"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.3"
|
8
8
|
spec.authors = ["Civitaspo(takahiro.nakayama)", "Naotoshi Seo"]
|
9
9
|
spec.email = ["civitaspo@gmail.com", "sonots@gmail.com"]
|
10
10
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "fluentd"
|
21
|
+
spec.add_runtime_dependency "fluentd", ">= 0.10.45"
|
22
22
|
spec.add_development_dependency "bundler"
|
23
23
|
spec.add_development_dependency "rake"
|
24
24
|
spec.add_development_dependency "test-unit"
|
@@ -35,8 +35,10 @@ module Fluent
|
|
35
35
|
def configure(conf)
|
36
36
|
super
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
# Message for users about supported fluentd versions
|
39
|
+
supported_versions_information
|
40
|
+
|
41
|
+
configure_parser(conf)
|
40
42
|
|
41
43
|
if @processing_file_suffix.empty?
|
42
44
|
raise Fluent::ConfigError, "in_cat_sweep: `processing_file_suffix` must has some letters."
|
@@ -104,6 +106,56 @@ module Fluent
|
|
104
106
|
|
105
107
|
private
|
106
108
|
|
109
|
+
def configure_parser(conf)
|
110
|
+
if Plugin.respond_to?(:new_parser)
|
111
|
+
@parser = Plugin.new_parser(@format)
|
112
|
+
@parser.configure(conf)
|
113
|
+
else # For supporting fluentd lower than v0.10.58
|
114
|
+
@parser = TextParser.new
|
115
|
+
@parser.configure(conf)
|
116
|
+
# In lower version of fluentd than v0.10.50,
|
117
|
+
# `Fluent::Parser#parse` does not support block based API.
|
118
|
+
# cf. https://github.com/fluent/fluentd/blob/v0.10.49/lib/fluent/parser.rb#L270
|
119
|
+
# On the other hand, in newer version(like v0.14) of fluentd,
|
120
|
+
# `Fluent::Parser#parse` only supports block based API.
|
121
|
+
# cf. https://github.com/fluent/fluentd/blob/v0.14.0.rc.3/lib/fluent/plugin/parser_tsv.rb#L33
|
122
|
+
# So, lower version of `Fluent::Parser#parse` extends the way to call by block based API.
|
123
|
+
@parser.extend(Module.new {
|
124
|
+
def parse(line)
|
125
|
+
time, record = super
|
126
|
+
yield(time, record)
|
127
|
+
return
|
128
|
+
end
|
129
|
+
})
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def supported_versions_information
|
134
|
+
if current_fluent_version < fluent_version('0.12.0')
|
135
|
+
log.warn "in_cat_sweep: the support for fluentd v0.10 will end near future. Please upgrade your fluentd or fix this plugin version."
|
136
|
+
end
|
137
|
+
if current_fluent_version < fluent_version('0.10.58')
|
138
|
+
log.warn "in_cat_sweep: fluentd officially supports Plugin.new_parser/Plugin.register_parser APIs from v0.10.58." \
|
139
|
+
" The support for v0.10.58 will end near future." \
|
140
|
+
" Please upgrade your fluentd or fix this plugin version."
|
141
|
+
end
|
142
|
+
if current_fluent_version < fluent_version('0.10.46')
|
143
|
+
log.warn "in_cat_sweep: fluentd officially supports parser plugin from v0.10.46." \
|
144
|
+
" If you use `time_key` parameter and fluentd v0.10.45, doesn't work properly." \
|
145
|
+
" The support for v0.10.45 will end near future." \
|
146
|
+
" Please upgrade your fluentd or fix this plugin version."
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def current_fluent_version
|
151
|
+
parse_version_comparable(Fluent::VERSION)
|
152
|
+
end
|
153
|
+
|
154
|
+
def parse_version_comparable(v)
|
155
|
+
Gem::Version.new(v)
|
156
|
+
end
|
157
|
+
alias :fluent_version :parse_version_comparable # For the readability
|
158
|
+
|
107
159
|
def will_process?(filename)
|
108
160
|
!(processing?(filename) or error_file?(filename) or sufficient_waiting?(filename))
|
109
161
|
end
|
data/test/helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
require 'fluent/version'
|
2
3
|
require 'fluent/log'
|
3
4
|
require 'fluent/test'
|
4
5
|
|
@@ -26,3 +27,12 @@ module Fluent
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
30
|
+
|
31
|
+
|
32
|
+
def current_fluent_version
|
33
|
+
fluent_version(Fluent::VERSION)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fluent_version(v)
|
37
|
+
Gem::Version.new(v)
|
38
|
+
end
|
data/test/test_in_cat_sweep.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'helper'
|
2
2
|
require 'rr'
|
3
|
+
require 'fluent/input'
|
3
4
|
require 'fluent/plugin/in_cat_sweep'
|
4
5
|
|
5
6
|
class CatSweepInputTest < Test::Unit::TestCase
|
@@ -22,13 +23,28 @@ class CatSweepInputTest < Test::Unit::TestCase
|
|
22
23
|
run_interval 0.05
|
23
24
|
]
|
24
25
|
|
25
|
-
CONFIG_MINIMUM_REQUIRED =
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
CONFIG_MINIMUM_REQUIRED =
|
27
|
+
if current_fluent_version < fluent_version('0.12.0')
|
28
|
+
CONFIG_BASE + %[
|
29
|
+
format tsv
|
30
|
+
keys ""
|
31
|
+
waiting_seconds 5
|
32
|
+
]
|
33
|
+
else
|
34
|
+
CONFIG_BASE + %[
|
35
|
+
format tsv
|
36
|
+
waiting_seconds 5
|
37
|
+
]
|
38
|
+
end
|
29
39
|
|
30
40
|
def create_driver(conf, use_v1 = true)
|
31
|
-
Fluent::Test::InputTestDriver.new(Fluent::CatSweepInput)
|
41
|
+
driver = Fluent::Test::InputTestDriver.new(Fluent::CatSweepInput)
|
42
|
+
if current_fluent_version < fluent_version('0.10.51')
|
43
|
+
driver.configure(conf)
|
44
|
+
else
|
45
|
+
driver.configure(conf, use_v1)
|
46
|
+
end
|
47
|
+
driver
|
32
48
|
end
|
33
49
|
|
34
50
|
def test_required_configure
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-cat-sweep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Civitaspo(takahiro.nakayama)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 0.10.45
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 0.10.45
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +127,9 @@ files:
|
|
127
127
|
- Rakefile
|
128
128
|
- example.conf
|
129
129
|
- fluent-plugin-cat-sweep.gemspec
|
130
|
+
- gemfiles/Gemfile.fluentd.0.10
|
131
|
+
- gemfiles/Gemfile.fluentd.0.10.45
|
132
|
+
- gemfiles/Gemfile.fluentd.0.12
|
130
133
|
- lib/fluent/plugin/in_cat_sweep.rb
|
131
134
|
- test/helper.rb
|
132
135
|
- test/test_in_cat_sweep.rb
|
@@ -150,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
153
|
version: '0'
|
151
154
|
requirements: []
|
152
155
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.5.1
|
154
157
|
signing_key:
|
155
158
|
specification_version: 4
|
156
159
|
summary: Fluentd plugin to cat files and move them.
|