fluentd 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fluentd might be problematic. Click here for more details.
- data/AUTHORS +1 -0
- data/COPYING +14 -0
- data/ChangeLog +178 -0
- data/README.rdoc +57 -0
- data/Rakefile +62 -0
- data/VERSION +1 -0
- data/bin/fluent-cat +6 -0
- data/bin/fluent-gem +10 -0
- data/bin/fluentd +6 -0
- data/fluent.conf +78 -0
- data/fluentd.gemspec +116 -0
- data/lib/fluent/buffer.rb +274 -0
- data/lib/fluent/command/cat.rb +299 -0
- data/lib/fluent/command/fluentd.rb +245 -0
- data/lib/fluent/config.rb +304 -0
- data/lib/fluent/engine.rb +224 -0
- data/lib/fluent/env.rb +6 -0
- data/lib/fluent/event.rb +159 -0
- data/lib/fluent/input.rb +41 -0
- data/lib/fluent/load.rb +23 -0
- data/lib/fluent/log.rb +277 -0
- data/lib/fluent/match.rb +189 -0
- data/lib/fluent/mixin.rb +170 -0
- data/lib/fluent/output.rb +466 -0
- data/lib/fluent/parser.rb +115 -0
- data/lib/fluent/plugin.rb +145 -0
- data/lib/fluent/plugin/buf_file.rb +181 -0
- data/lib/fluent/plugin/buf_memory.rb +97 -0
- data/lib/fluent/plugin/buf_zfile.rb +84 -0
- data/lib/fluent/plugin/in_http.rb +282 -0
- data/lib/fluent/plugin/in_stream.rb +187 -0
- data/lib/fluent/plugin/in_syslog.rb +174 -0
- data/lib/fluent/plugin/in_tail.rb +150 -0
- data/lib/fluent/plugin/out_copy.rb +72 -0
- data/lib/fluent/plugin/out_file.rb +111 -0
- data/lib/fluent/plugin/out_null.rb +44 -0
- data/lib/fluent/plugin/out_roundrobin.rb +72 -0
- data/lib/fluent/plugin/out_stdout.rb +34 -0
- data/lib/fluent/plugin/out_stream.rb +128 -0
- data/lib/fluent/plugin/out_test.rb +68 -0
- data/lib/fluent/test.rb +8 -0
- data/lib/fluent/test/base.rb +63 -0
- data/lib/fluent/test/input_test.rb +89 -0
- data/lib/fluent/test/output_test.rb +93 -0
- data/lib/fluent/version.rb +5 -0
- data/test/helper.rb +6 -0
- data/test/match.rb +115 -0
- data/test/plugin/in_http.rb +84 -0
- data/test/plugin/in_stream.rb +136 -0
- data/test/plugin/out_copy.rb +55 -0
- data/test/plugin/out_file.rb +82 -0
- data/test/plugin/out_roundrobin.rb +65 -0
- data/test/plugin/out_stream.rb +74 -0
- metadata +224 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'fluent/test'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'time'
|
4
|
+
|
5
|
+
class FileOutputTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
Fluent::Test.setup
|
8
|
+
FileUtils.rm_rf(TMP_DIR)
|
9
|
+
FileUtils.mkdir_p(TMP_DIR)
|
10
|
+
end
|
11
|
+
|
12
|
+
TMP_DIR = File.dirname(__FILE__) + "/../tmp"
|
13
|
+
|
14
|
+
CONFIG = %[
|
15
|
+
path #{TMP_DIR}/out_file_test
|
16
|
+
compress gz
|
17
|
+
utc
|
18
|
+
]
|
19
|
+
|
20
|
+
def create_driver(conf = CONFIG)
|
21
|
+
Fluent::Test::BufferedOutputTestDriver.new(Fluent::FileOutput).configure(conf)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_configure
|
25
|
+
d = create_driver %[
|
26
|
+
path test_path
|
27
|
+
compress gz
|
28
|
+
]
|
29
|
+
assert_equal 'test_path', d.instance.path
|
30
|
+
assert_equal :gz, d.instance.compress
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_format
|
34
|
+
d = create_driver
|
35
|
+
|
36
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
37
|
+
d.emit({"a"=>1}, time)
|
38
|
+
d.emit({"a"=>2}, time)
|
39
|
+
|
40
|
+
d.expect_format %[2011-01-02T13:14:15Z\ttest\t{"a":1}\n]
|
41
|
+
d.expect_format %[2011-01-02T13:14:15Z\ttest\t{"a":2}\n]
|
42
|
+
|
43
|
+
d.run
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_write
|
47
|
+
d = create_driver
|
48
|
+
|
49
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
50
|
+
d.emit({"a"=>1}, time)
|
51
|
+
d.emit({"a"=>2}, time)
|
52
|
+
|
53
|
+
# FileOutput#write returns path
|
54
|
+
path = d.run
|
55
|
+
expect_path = "#{TMP_DIR}/out_file_test._0.log.gz"
|
56
|
+
assert_equal expect_path, path
|
57
|
+
|
58
|
+
data = Zlib::GzipReader.open(expect_path) {|f| f.read }
|
59
|
+
assert_equal %[2011-01-02T13:14:15Z\ttest\t{"a":1}\n] +
|
60
|
+
%[2011-01-02T13:14:15Z\ttest\t{"a":2}\n],
|
61
|
+
data
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_write_path_increment
|
65
|
+
d = create_driver
|
66
|
+
|
67
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
68
|
+
d.emit({"a"=>1}, time)
|
69
|
+
d.emit({"a"=>2}, time)
|
70
|
+
|
71
|
+
# FileOutput#write returns path
|
72
|
+
path = d.run
|
73
|
+
assert_equal "#{TMP_DIR}/out_file_test._0.log.gz", path
|
74
|
+
|
75
|
+
path = d.run
|
76
|
+
assert_equal "#{TMP_DIR}/out_file_test._1.log.gz", path
|
77
|
+
|
78
|
+
path = d.run
|
79
|
+
assert_equal "#{TMP_DIR}/out_file_test._2.log.gz", path
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'fluent/test'
|
2
|
+
|
3
|
+
class RoundRobinOutputTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
Fluent::Test.setup
|
6
|
+
end
|
7
|
+
|
8
|
+
CONFIG = %[
|
9
|
+
<store>
|
10
|
+
type test
|
11
|
+
name c0
|
12
|
+
</store>
|
13
|
+
<store>
|
14
|
+
type test
|
15
|
+
name c1
|
16
|
+
</store>
|
17
|
+
<store>
|
18
|
+
type test
|
19
|
+
name c2
|
20
|
+
</store>
|
21
|
+
]
|
22
|
+
|
23
|
+
def create_driver(conf = CONFIG)
|
24
|
+
Fluent::Test::OutputTestDriver.new(Fluent::RoundRobinOutput).configure(conf)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_configure
|
28
|
+
d = create_driver
|
29
|
+
|
30
|
+
outputs = d.instance.outputs
|
31
|
+
assert_equal 3, outputs.size
|
32
|
+
assert_equal Fluent::TestOutput, outputs[0].class
|
33
|
+
assert_equal Fluent::TestOutput, outputs[1].class
|
34
|
+
assert_equal Fluent::TestOutput, outputs[2].class
|
35
|
+
assert_equal "c0", outputs[0].name
|
36
|
+
assert_equal "c1", outputs[1].name
|
37
|
+
assert_equal "c2", outputs[2].name
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_emit
|
41
|
+
d = create_driver
|
42
|
+
|
43
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
44
|
+
d.emit({"a"=>1}, time)
|
45
|
+
d.emit({"a"=>2}, time)
|
46
|
+
d.emit({"a"=>3}, time)
|
47
|
+
d.emit({"a"=>4}, time)
|
48
|
+
|
49
|
+
os = d.instance.outputs
|
50
|
+
|
51
|
+
assert_equal [
|
52
|
+
[time, {"a"=>1}],
|
53
|
+
[time, {"a"=>4}],
|
54
|
+
], os[0].events
|
55
|
+
|
56
|
+
assert_equal [
|
57
|
+
[time, {"a"=>2}],
|
58
|
+
], os[1].events
|
59
|
+
|
60
|
+
assert_equal [
|
61
|
+
[time, {"a"=>3}],
|
62
|
+
], os[2].events
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'fluent/test'
|
2
|
+
|
3
|
+
module StreamOutputTest
|
4
|
+
def setup
|
5
|
+
Fluent::Test.setup
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_write
|
9
|
+
d = create_driver
|
10
|
+
|
11
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
12
|
+
d.emit({"a"=>1}, time)
|
13
|
+
d.emit({"a"=>2}, time)
|
14
|
+
|
15
|
+
expect = ["test",
|
16
|
+
[time,{"a"=>1}].to_msgpack +
|
17
|
+
[time,{"a"=>2}].to_msgpack
|
18
|
+
].to_msgpack
|
19
|
+
|
20
|
+
result = d.run
|
21
|
+
assert_equal(expect, result)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_driver(klass, conf)
|
25
|
+
Fluent::Test::BufferedOutputTestDriver.new(klass) do
|
26
|
+
def write(chunk)
|
27
|
+
chunk.read
|
28
|
+
end
|
29
|
+
end.configure(conf)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class TcpOutputTest < Test::Unit::TestCase
|
34
|
+
include StreamOutputTest
|
35
|
+
|
36
|
+
CONFIG = %[
|
37
|
+
port 13999
|
38
|
+
host 127.0.0.1
|
39
|
+
send_timeout 51
|
40
|
+
]
|
41
|
+
|
42
|
+
def create_driver(conf=CONFIG)
|
43
|
+
super(Fluent::TcpOutput, conf)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_configure
|
47
|
+
d = create_driver
|
48
|
+
assert_equal 13999, d.instance.port
|
49
|
+
assert_equal '127.0.0.1', d.instance.host
|
50
|
+
assert_equal 51, d.instance.send_timeout
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class UnixOutputTest < Test::Unit::TestCase
|
55
|
+
include StreamOutputTest
|
56
|
+
|
57
|
+
TMP_DIR = File.dirname(__FILE__) + "/../tmp"
|
58
|
+
|
59
|
+
CONFIG = %[
|
60
|
+
path #{TMP_DIR}/unix
|
61
|
+
send_timeout 52
|
62
|
+
]
|
63
|
+
|
64
|
+
def create_driver(conf=CONFIG)
|
65
|
+
super(Fluent::UnixOutput, conf)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_configure
|
69
|
+
d = create_driver
|
70
|
+
assert_equal "#{TMP_DIR}/unix", d.instance.path
|
71
|
+
assert_equal 52, d.instance.send_timeout
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
metadata
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluentd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 55
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 10
|
9
|
+
- 0
|
10
|
+
version: 0.10.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Sadayuki Furuhashi
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-16 00:00:00 +09:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: msgpack
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 4
|
33
|
+
- 4
|
34
|
+
version: 0.4.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: json
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 1
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 4
|
49
|
+
- 3
|
50
|
+
version: 1.4.3
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: yajl-ruby
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 23
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 0
|
65
|
+
- 0
|
66
|
+
version: 1.0.0
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cool.io
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 23
|
78
|
+
segments:
|
79
|
+
- 1
|
80
|
+
- 0
|
81
|
+
- 0
|
82
|
+
version: 1.0.0
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: http_parser.rb
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 9
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
- 5
|
97
|
+
- 1
|
98
|
+
version: 0.5.1
|
99
|
+
type: :runtime
|
100
|
+
version_requirements: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: rake
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 63
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
- 9
|
113
|
+
- 2
|
114
|
+
version: 0.9.2
|
115
|
+
type: :runtime
|
116
|
+
version_requirements: *id006
|
117
|
+
description:
|
118
|
+
email: frsyuki@gmail.com
|
119
|
+
executables:
|
120
|
+
- fluentd
|
121
|
+
- fluent-cat
|
122
|
+
- fluent-gem
|
123
|
+
extensions: []
|
124
|
+
|
125
|
+
extra_rdoc_files:
|
126
|
+
- ChangeLog
|
127
|
+
- README.rdoc
|
128
|
+
files:
|
129
|
+
- AUTHORS
|
130
|
+
- COPYING
|
131
|
+
- Rakefile
|
132
|
+
- VERSION
|
133
|
+
- bin/fluent-cat
|
134
|
+
- bin/fluent-gem
|
135
|
+
- bin/fluentd
|
136
|
+
- fluent.conf
|
137
|
+
- fluentd.gemspec
|
138
|
+
- lib/fluent/buffer.rb
|
139
|
+
- lib/fluent/command/cat.rb
|
140
|
+
- lib/fluent/command/fluentd.rb
|
141
|
+
- lib/fluent/config.rb
|
142
|
+
- lib/fluent/engine.rb
|
143
|
+
- lib/fluent/env.rb
|
144
|
+
- lib/fluent/event.rb
|
145
|
+
- lib/fluent/input.rb
|
146
|
+
- lib/fluent/load.rb
|
147
|
+
- lib/fluent/log.rb
|
148
|
+
- lib/fluent/match.rb
|
149
|
+
- lib/fluent/mixin.rb
|
150
|
+
- lib/fluent/output.rb
|
151
|
+
- lib/fluent/parser.rb
|
152
|
+
- lib/fluent/plugin.rb
|
153
|
+
- lib/fluent/plugin/buf_file.rb
|
154
|
+
- lib/fluent/plugin/buf_memory.rb
|
155
|
+
- lib/fluent/plugin/buf_zfile.rb
|
156
|
+
- lib/fluent/plugin/in_http.rb
|
157
|
+
- lib/fluent/plugin/in_stream.rb
|
158
|
+
- lib/fluent/plugin/in_syslog.rb
|
159
|
+
- lib/fluent/plugin/in_tail.rb
|
160
|
+
- lib/fluent/plugin/out_copy.rb
|
161
|
+
- lib/fluent/plugin/out_file.rb
|
162
|
+
- lib/fluent/plugin/out_null.rb
|
163
|
+
- lib/fluent/plugin/out_roundrobin.rb
|
164
|
+
- lib/fluent/plugin/out_stdout.rb
|
165
|
+
- lib/fluent/plugin/out_stream.rb
|
166
|
+
- lib/fluent/plugin/out_test.rb
|
167
|
+
- lib/fluent/test.rb
|
168
|
+
- lib/fluent/test/base.rb
|
169
|
+
- lib/fluent/test/input_test.rb
|
170
|
+
- lib/fluent/test/output_test.rb
|
171
|
+
- lib/fluent/version.rb
|
172
|
+
- test/helper.rb
|
173
|
+
- test/match.rb
|
174
|
+
- test/plugin/in_http.rb
|
175
|
+
- test/plugin/in_stream.rb
|
176
|
+
- test/plugin/out_copy.rb
|
177
|
+
- test/plugin/out_file.rb
|
178
|
+
- test/plugin/out_roundrobin.rb
|
179
|
+
- test/plugin/out_stream.rb
|
180
|
+
- ChangeLog
|
181
|
+
- README.rdoc
|
182
|
+
has_rdoc: true
|
183
|
+
homepage: http://fluentd.org/
|
184
|
+
licenses: []
|
185
|
+
|
186
|
+
post_install_message:
|
187
|
+
rdoc_options:
|
188
|
+
- --charset=UTF-8
|
189
|
+
require_paths:
|
190
|
+
- lib
|
191
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
hash: 3
|
197
|
+
segments:
|
198
|
+
- 0
|
199
|
+
version: "0"
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
hash: 3
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
version: "0"
|
209
|
+
requirements: []
|
210
|
+
|
211
|
+
rubyforge_project:
|
212
|
+
rubygems_version: 1.3.7
|
213
|
+
signing_key:
|
214
|
+
specification_version: 3
|
215
|
+
summary: Fluent event collector
|
216
|
+
test_files:
|
217
|
+
- test/helper.rb
|
218
|
+
- test/match.rb
|
219
|
+
- test/plugin/in_http.rb
|
220
|
+
- test/plugin/in_stream.rb
|
221
|
+
- test/plugin/out_copy.rb
|
222
|
+
- test/plugin/out_file.rb
|
223
|
+
- test/plugin/out_roundrobin.rb
|
224
|
+
- test/plugin/out_stream.rb
|