fluentd 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/fluentd.gemspec +1 -1
- data/lib/fluent/command/plugin_config_formatter.rb +1 -1
- data/lib/fluent/plugin/in_tail.rb +17 -7
- data/lib/fluent/plugin/in_udp.rb +3 -1
- data/lib/fluent/plugin/out_forward.rb +6 -2
- data/lib/fluent/plugin_helper/socket_option.rb +5 -2
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_plugin_config_formatter.rb +6 -6
- data/test/plugin/test_in_tail.rb +94 -2
- data/test/plugin/test_in_udp.rb +34 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1585c5b08cc563404db3e0901bf745c79b2d4e9d
|
4
|
+
data.tar.gz: e010df6ece76b3b516d91798d295b37fcdaf6fab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dee5732e3915f8e03f697cb5d0176cf0eef2c490d0136d8b1f8cc53c2028abd269a01ae8dee13a335a36adb132b30ca39238d80968b0eb336996f626eb965530
|
7
|
+
data.tar.gz: 68dcb7db0688e8963d0de610371eb9f19d2cade0f8ddf631584a795ac66c27a1cfbd3f50c618178ef04cd17c3a14378fa8f4d22b0714acc2bab871903b9e5f64
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,28 @@
|
|
1
1
|
# v1.0
|
2
2
|
|
3
|
+
## Release v1.0.1 - 2017/12/14
|
4
|
+
|
5
|
+
### New features / Enhancements
|
6
|
+
|
7
|
+
* in_udp: Add receive_buffer_size parameter
|
8
|
+
https://github.com/fluent/fluentd/pull/1788
|
9
|
+
* in_tail: Add enable_stat_watcher option to disable inotify events
|
10
|
+
https://github.com/fluent/fluentd/pull/1775
|
11
|
+
* Relax strptime gem version
|
12
|
+
|
13
|
+
### Bug fixes
|
14
|
+
|
15
|
+
* in_tail: Properly handle moved back and truncated case
|
16
|
+
https://github.com/fluent/fluentd/pull/1793
|
17
|
+
* out_forward: Rebuild weight array to apply server setting properly
|
18
|
+
https://github.com/fluent/fluentd/pull/1784
|
19
|
+
* fluent-plugin-config-formatter: Use v1.0 for URL
|
20
|
+
https://github.com/fluent/fluentd/pull/1781
|
21
|
+
|
3
22
|
## Release v1.0.0 - 2017/12/6
|
4
23
|
|
24
|
+
See [CNCF announcment](https://www.cncf.io/blog/2017/12/06/fluentd-v1-0/) :)
|
25
|
+
|
5
26
|
### New features / Enhancements
|
6
27
|
|
7
28
|
* out_copy: Support ignore_error argument in `<store>`
|
data/fluentd.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
|
28
28
|
gem.add_runtime_dependency("tzinfo", ["~> 1.0"])
|
29
29
|
gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
|
30
|
-
gem.add_runtime_dependency("strptime", ["~> 0.1
|
30
|
+
gem.add_runtime_dependency("strptime", ["~> 0.1"])
|
31
31
|
gem.add_runtime_dependency("ruby_dig", ["~> 0.0.2"])
|
32
32
|
|
33
33
|
# build gem for a certain platform. see also Rakefile
|
@@ -31,7 +31,7 @@ class FluentPluginConfigFormatter
|
|
31
31
|
"buffer", "parser", "formatter", "storage"
|
32
32
|
]
|
33
33
|
|
34
|
-
DOCS_BASE_URL = "https://docs.fluentd.org/
|
34
|
+
DOCS_BASE_URL = "https://docs.fluentd.org/v1.0/articles/"
|
35
35
|
|
36
36
|
def initialize(argv = ARGV)
|
37
37
|
@argv = argv
|
@@ -80,6 +80,8 @@ module Fluent::Plugin
|
|
80
80
|
config_param :emit_unmatched_lines, :bool, default: false
|
81
81
|
desc 'Enable the additional watch timer.'
|
82
82
|
config_param :enable_watch_timer, :bool, default: true
|
83
|
+
desc 'Enable the stat watcher based on inotify.'
|
84
|
+
config_param :enable_stat_watcher, :bool, default: true
|
83
85
|
desc 'The encoding after conversion of the input.'
|
84
86
|
config_param :encoding, :string, default: nil
|
85
87
|
desc 'The encoding of the input.'
|
@@ -115,6 +117,10 @@ module Fluent::Plugin
|
|
115
117
|
|
116
118
|
super
|
117
119
|
|
120
|
+
if !@enable_watch_timer && !@enable_stat_watcher
|
121
|
+
raise Fluent::ConfigError, "either of enable_watch_timer or enable_stat_watcher must be true"
|
122
|
+
end
|
123
|
+
|
118
124
|
@paths = @path.split(',').map {|path| path.strip }
|
119
125
|
if @paths.empty?
|
120
126
|
raise Fluent::ConfigError, "tail: 'path' parameter is required on tail input"
|
@@ -254,10 +260,10 @@ module Fluent::Plugin
|
|
254
260
|
|
255
261
|
def setup_watcher(path, pe)
|
256
262
|
line_buffer_timer_flusher = (@multiline_mode && @multiline_flush_interval) ? TailWatcher::LineBufferTimerFlusher.new(log, @multiline_flush_interval, &method(:flush_buffer)) : nil
|
257
|
-
tw = TailWatcher.new(path, @rotate_wait, pe, log, @read_from_head, @enable_watch_timer, @read_lines_limit, method(:update_watcher), line_buffer_timer_flusher, @from_encoding, @encoding, open_on_every_update, &method(:receive_lines))
|
263
|
+
tw = TailWatcher.new(path, @rotate_wait, pe, log, @read_from_head, @enable_watch_timer, @enable_stat_watcher, @read_lines_limit, method(:update_watcher), line_buffer_timer_flusher, @from_encoding, @encoding, open_on_every_update, &method(:receive_lines))
|
258
264
|
tw.attach do |watcher|
|
259
265
|
watcher.timer_trigger = timer_execute(:in_tail_timer_trigger, 1, &watcher.method(:on_notify)) if watcher.enable_watch_timer
|
260
|
-
event_loop_attach(watcher.stat_trigger)
|
266
|
+
event_loop_attach(watcher.stat_trigger) if watcher.enable_stat_watcher
|
261
267
|
end
|
262
268
|
tw
|
263
269
|
rescue => e
|
@@ -457,17 +463,18 @@ module Fluent::Plugin
|
|
457
463
|
end
|
458
464
|
|
459
465
|
class TailWatcher
|
460
|
-
def initialize(path, rotate_wait, pe, log, read_from_head, enable_watch_timer, read_lines_limit, update_watcher, line_buffer_timer_flusher, from_encoding, encoding, open_on_every_update, &receive_lines)
|
466
|
+
def initialize(path, rotate_wait, pe, log, read_from_head, enable_watch_timer, enable_stat_watcher, read_lines_limit, update_watcher, line_buffer_timer_flusher, from_encoding, encoding, open_on_every_update, &receive_lines)
|
461
467
|
@path = path
|
462
468
|
@rotate_wait = rotate_wait
|
463
469
|
@pe = pe || MemoryPositionEntry.new
|
464
470
|
@read_from_head = read_from_head
|
465
471
|
@enable_watch_timer = enable_watch_timer
|
472
|
+
@enable_stat_watcher = enable_stat_watcher
|
466
473
|
@read_lines_limit = read_lines_limit
|
467
474
|
@receive_lines = receive_lines
|
468
475
|
@update_watcher = update_watcher
|
469
476
|
|
470
|
-
@stat_trigger = StatWatcher.new(self, &method(:on_notify))
|
477
|
+
@stat_trigger = @enable_stat_watcher ? StatWatcher.new(self, &method(:on_notify)) : nil
|
471
478
|
@timer_trigger = nil
|
472
479
|
|
473
480
|
@rotate_handler = RotateHandler.new(self, &method(:on_rotate))
|
@@ -483,7 +490,7 @@ module Fluent::Plugin
|
|
483
490
|
attr_reader :path
|
484
491
|
attr_reader :log, :pe, :read_lines_limit, :open_on_every_update
|
485
492
|
attr_reader :from_encoding, :encoding
|
486
|
-
attr_reader :stat_trigger, :enable_watch_timer
|
493
|
+
attr_reader :stat_trigger, :enable_watch_timer, :enable_stat_watcher
|
487
494
|
attr_accessor :timer_trigger
|
488
495
|
attr_accessor :line_buffer, :line_buffer_timer_flusher
|
489
496
|
attr_accessor :unwatched # This is used for removing position entry from PositionFile
|
@@ -503,7 +510,7 @@ module Fluent::Plugin
|
|
503
510
|
|
504
511
|
def detach
|
505
512
|
@timer_trigger.detach if @enable_watch_timer && @timer_trigger && @timer_trigger.attached?
|
506
|
-
@stat_trigger.detach if @stat_trigger && @stat_trigger.attached?
|
513
|
+
@stat_trigger.detach if @enable_stat_watcher && @stat_trigger && @stat_trigger.attached?
|
507
514
|
@io_handler.on_notify if @io_handler
|
508
515
|
end
|
509
516
|
|
@@ -540,7 +547,10 @@ module Fluent::Plugin
|
|
540
547
|
# assuming following situation:
|
541
548
|
# a) file was once renamed and backed, or
|
542
549
|
# b) symlink or hardlink to the same file is recreated
|
543
|
-
# in either case, seek to the saved position
|
550
|
+
# in either case of a and b, seek to the saved position
|
551
|
+
# c) file was once renamed, truncated and then backed
|
552
|
+
# in this case, consider it truncated
|
553
|
+
@pe.update(inode, 0) if fsize < @pe.read_pos
|
544
554
|
elsif last_inode != 0
|
545
555
|
# this is FilePositionEntry and fluentd once started.
|
546
556
|
# read data from the head of the rotated file.
|
data/lib/fluent/plugin/in_udp.rb
CHANGED
@@ -40,6 +40,8 @@ module Fluent::Plugin
|
|
40
40
|
config_param :message_length_limit, :size, default: 4096
|
41
41
|
desc "Remove newline from the end of incoming payload"
|
42
42
|
config_param :remove_newline, :bool, default: true
|
43
|
+
desc "The max size of socket receive buffer. SO_RCVBUF"
|
44
|
+
config_param :receive_buffer_size, :size, default: nil
|
43
45
|
|
44
46
|
config_param :blocking_timeout, :time, default: 0.5
|
45
47
|
|
@@ -61,7 +63,7 @@ module Fluent::Plugin
|
|
61
63
|
super
|
62
64
|
|
63
65
|
log.info "listening udp socket", bind: @bind, port: @port
|
64
|
-
server_create(:in_udp_server, @port, proto: :udp, bind: @bind, max_bytes: @message_length_limit) do |data, sock|
|
66
|
+
server_create(:in_udp_server, @port, proto: :udp, bind: @bind, max_bytes: @message_length_limit, receive_buffer_size: @receive_buffer_size) do |data, sock|
|
65
67
|
data.chomp! if @remove_newline
|
66
68
|
begin
|
67
69
|
@parser.parse(data) do |time, record|
|
@@ -398,7 +398,9 @@ module Fluent::Plugin
|
|
398
398
|
begin
|
399
399
|
log.trace "sending heartbeat", host: n.host, port: n.port, heartbeat_type: @heartbeat_type
|
400
400
|
n.usock = @usock if @usock
|
401
|
-
n.send_heartbeat
|
401
|
+
if n.send_heartbeat
|
402
|
+
rebuild_weight_array
|
403
|
+
end
|
402
404
|
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR, Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
|
403
405
|
log.debug "failed to send heartbeat packet", host: n.host, port: n.port, heartbeat_type: @heartbeat_type, error: e
|
404
406
|
rescue => e
|
@@ -665,11 +667,13 @@ module Fluent::Plugin
|
|
665
667
|
## don't send any data to not cause a compatibility problem
|
666
668
|
# sock.write FORWARD_TCP_HEARTBEAT_DATA
|
667
669
|
|
668
|
-
# successful tcp connection establishment is considered as valid heartbeat
|
670
|
+
# successful tcp connection establishment is considered as valid heartbeat.
|
671
|
+
# When heartbeat is succeeded after detached, return true. It rebuilds weight array.
|
669
672
|
heartbeat(true)
|
670
673
|
end
|
671
674
|
when :udp
|
672
675
|
@usock.send "\0", 0, Socket.pack_sockaddr_in(@port, resolved_host)
|
676
|
+
nil
|
673
677
|
when :none # :none doesn't use this class
|
674
678
|
raise "BUG: heartbeat_type none must not use Node"
|
675
679
|
else
|
@@ -24,7 +24,7 @@ module Fluent
|
|
24
24
|
FORMAT_STRUCT_LINGER = 'I!I!' # { int l_onoff; int l_linger; }
|
25
25
|
FORMAT_STRUCT_TIMEVAL = 'L!L!' # { time_t tv_sec; suseconds_t tv_usec; }
|
26
26
|
|
27
|
-
def socket_option_validate!(protocol, resolve_name: nil, linger_timeout: nil, recv_timeout: nil, send_timeout: nil)
|
27
|
+
def socket_option_validate!(protocol, resolve_name: nil, linger_timeout: nil, recv_timeout: nil, send_timeout: nil, receive_buffer_size: nil)
|
28
28
|
unless resolve_name.nil?
|
29
29
|
if protocol != :tcp && protocol != :udp && protocol != :tls
|
30
30
|
raise ArgumentError, "BUG: resolve_name in available for tcp/udp/tls"
|
@@ -37,7 +37,7 @@ module Fluent
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def socket_option_set(sock, resolve_name: nil, nonblock: false, linger_timeout: nil, recv_timeout: nil, send_timeout: nil)
|
40
|
+
def socket_option_set(sock, resolve_name: nil, nonblock: false, linger_timeout: nil, recv_timeout: nil, send_timeout: nil, receive_buffer_size: nil)
|
41
41
|
unless resolve_name.nil?
|
42
42
|
sock.do_not_reverse_lookup = !resolve_name
|
43
43
|
end
|
@@ -56,6 +56,9 @@ module Fluent
|
|
56
56
|
optval = [send_timeout.to_i, 0].pack(FORMAT_STRUCT_TIMEVAL)
|
57
57
|
socket_option_set_one(sock, :SO_SNDTIMEO, optval)
|
58
58
|
end
|
59
|
+
if receive_buffer_size
|
60
|
+
socket_option_set_one(sock, :SO_RCVBUF, receive_buffer_size.to_i)
|
61
|
+
end
|
59
62
|
sock
|
60
63
|
end
|
61
64
|
|
data/lib/fluent/version.rb
CHANGED
@@ -179,10 +179,10 @@ TEXT
|
|
179
179
|
expected = <<TEXT
|
180
180
|
## Plugin helpers
|
181
181
|
|
182
|
-
* [inject](https://docs.fluentd.org/
|
183
|
-
* [compat_parameters](https://docs.fluentd.org/
|
182
|
+
* [inject](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-inject)
|
183
|
+
* [compat_parameters](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-compat_parameters)
|
184
184
|
|
185
|
-
* See also: [Input Plugin Overview](https://docs.fluentd.org/
|
185
|
+
* See also: [Input Plugin Overview](https://docs.fluentd.org/v1.0/articles/input-plugin-overview)
|
186
186
|
|
187
187
|
## TestFluentPluginConfigFormatter::SimpleInput
|
188
188
|
|
@@ -202,10 +202,10 @@ TEXT
|
|
202
202
|
expected = <<TEXT
|
203
203
|
## Plugin helpers
|
204
204
|
|
205
|
-
* [inject](https://docs.fluentd.org/
|
206
|
-
* [compat_parameters](https://docs.fluentd.org/
|
205
|
+
* [inject](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-inject)
|
206
|
+
* [compat_parameters](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-compat_parameters)
|
207
207
|
|
208
|
-
* See also: [Output Plugin Overview](https://docs.fluentd.org/
|
208
|
+
* See also: [Output Plugin Overview](https://docs.fluentd.org/v1.0/articles/output-plugin-overview)
|
209
209
|
|
210
210
|
## TestFluentPluginConfigFormatter::ComplexOutput
|
211
211
|
|
data/test/plugin/test_in_tail.rb
CHANGED
@@ -41,6 +41,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
41
41
|
COMMON_CONFIG = CONFIG + config_element("", "", { "pos_file" => "#{TMP_DIR}/tail.pos" })
|
42
42
|
CONFIG_READ_FROM_HEAD = config_element("", "", { "read_from_head" => true })
|
43
43
|
CONFIG_ENABLE_WATCH_TIMER = config_element("", "", { "enable_watch_timer" => false })
|
44
|
+
CONFIG_DISABLE_STAT_WATCHER = config_element("", "", { "enable_stat_watcher" => false })
|
44
45
|
CONFIG_OPEN_ON_EVERY_UPDATE = config_element("", "", { "open_on_every_update" => true })
|
45
46
|
SINGLE_LINE_CONFIG = config_element("", "", { "format" => "/(?<message>.*)/" })
|
46
47
|
PARSE_SINGLE_LINE_CONFIG = config_element("", "", {}, [config_element("parse", "", { "@type" => "/(?<message>.*)/" })])
|
@@ -83,6 +84,12 @@ class TailInputTest < Test::Unit::TestCase
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
87
|
+
test "both enable_watch_timer and enable_stat_watcher are false" do
|
88
|
+
assert_raise(Fluent::ConfigError) do
|
89
|
+
create_driver(CONFIG_ENABLE_WATCH_TIMER + CONFIG_DISABLE_STAT_WATCHER + PARSE_SINGLE_LINE_CONFIG)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
86
93
|
sub_test_case "encoding" do
|
87
94
|
test "valid" do
|
88
95
|
conf = SINGLE_LINE_CONFIG + config_element("", "", { "encoding" => "utf-8" })
|
@@ -256,6 +263,30 @@ class TailInputTest < Test::Unit::TestCase
|
|
256
263
|
assert_equal({"message" => "test3"}, events[0][2])
|
257
264
|
assert_equal({"message" => "test4"}, events[1][2])
|
258
265
|
end
|
266
|
+
|
267
|
+
data(flat: CONFIG_DISABLE_STAT_WATCHER + SINGLE_LINE_CONFIG,
|
268
|
+
parse: CONFIG_DISABLE_STAT_WATCHER + PARSE_SINGLE_LINE_CONFIG)
|
269
|
+
def test_emit_with_disable_stat_watcher(data)
|
270
|
+
config = data
|
271
|
+
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
|
272
|
+
f.puts "test1"
|
273
|
+
f.puts "test2"
|
274
|
+
}
|
275
|
+
|
276
|
+
d = create_driver(config)
|
277
|
+
|
278
|
+
d.run(expect_emits: 1) do
|
279
|
+
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
|
280
|
+
f.puts "test3"
|
281
|
+
f.puts "test4"
|
282
|
+
}
|
283
|
+
end
|
284
|
+
|
285
|
+
events = d.events
|
286
|
+
assert(events.length > 0)
|
287
|
+
assert_equal({"message" => "test3"}, events[0][2])
|
288
|
+
assert_equal({"message" => "test4"}, events[1][2])
|
289
|
+
end
|
259
290
|
end
|
260
291
|
|
261
292
|
class TestWithSystem < self
|
@@ -440,6 +471,67 @@ class TailInputTest < Test::Unit::TestCase
|
|
440
471
|
end
|
441
472
|
end
|
442
473
|
|
474
|
+
def test_truncate_file
|
475
|
+
config = SINGLE_LINE_CONFIG
|
476
|
+
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
|
477
|
+
f.puts "test1"
|
478
|
+
f.puts "test2"
|
479
|
+
}
|
480
|
+
|
481
|
+
d = create_driver(config)
|
482
|
+
|
483
|
+
d.run(expect_emits: 2) do
|
484
|
+
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
|
485
|
+
f.puts "test3\ntest4"
|
486
|
+
f.flush
|
487
|
+
}
|
488
|
+
sleep 1
|
489
|
+
File.truncate("#{TMP_DIR}/tail.txt", 6)
|
490
|
+
end
|
491
|
+
|
492
|
+
events = d.events
|
493
|
+
assert_equal(3, events.length)
|
494
|
+
assert_equal({"message" => "test3"}, events[0][2])
|
495
|
+
assert_equal({"message" => "test4"}, events[1][2])
|
496
|
+
assert_equal({"message" => "test1"}, events[2][2])
|
497
|
+
assert(events[0][1].is_a?(Fluent::EventTime))
|
498
|
+
assert(events[1][1].is_a?(Fluent::EventTime))
|
499
|
+
assert(events[2][1].is_a?(Fluent::EventTime))
|
500
|
+
assert_equal(2, d.emit_count)
|
501
|
+
end
|
502
|
+
|
503
|
+
def test_move_truncate_move_back
|
504
|
+
config = SINGLE_LINE_CONFIG
|
505
|
+
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
|
506
|
+
f.puts "test1"
|
507
|
+
f.puts "test2"
|
508
|
+
}
|
509
|
+
|
510
|
+
d = create_driver(config)
|
511
|
+
|
512
|
+
d.run(expect_emits: 1) do
|
513
|
+
if Fluent.windows?
|
514
|
+
FileUtils.mv("#{TMP_DIR}/tail.txt", "#{TMP_DIR}/tail2.txt", force: true)
|
515
|
+
else
|
516
|
+
FileUtils.mv("#{TMP_DIR}/tail.txt", "#{TMP_DIR}/tail2.txt")
|
517
|
+
end
|
518
|
+
sleep(1)
|
519
|
+
File.truncate("#{TMP_DIR}/tail2.txt", 6)
|
520
|
+
sleep(1)
|
521
|
+
if Fluent.windows?
|
522
|
+
FileUtils.mv("#{TMP_DIR}/tail2.txt", "#{TMP_DIR}/tail.txt", force: true)
|
523
|
+
else
|
524
|
+
FileUtils.mv("#{TMP_DIR}/tail2.txt", "#{TMP_DIR}/tail.txt")
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
528
|
+
events = d.events
|
529
|
+
assert_equal(1, events.length)
|
530
|
+
assert_equal({"message" => "test1"}, events[0][2])
|
531
|
+
assert(events[0][1].is_a?(Fluent::EventTime))
|
532
|
+
assert_equal(1, d.emit_count)
|
533
|
+
end
|
534
|
+
|
443
535
|
def test_lf
|
444
536
|
File.open("#{TMP_DIR}/tail.txt", "wb") {|f| }
|
445
537
|
|
@@ -926,7 +1018,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
926
1018
|
Timecop.freeze(2010, 1, 2, 3, 4, 5) do
|
927
1019
|
flexstub(Fluent::Plugin::TailInput::TailWatcher) do |watcherclass|
|
928
1020
|
EX_PATHS.each do |path|
|
929
|
-
watcherclass.should_receive(:new).with(path, EX_ROTATE_WAIT, Fluent::Plugin::TailInput::FilePositionEntry, any, true, true, 1000, any, any, any, any, any, any).once.and_return do
|
1021
|
+
watcherclass.should_receive(:new).with(path, EX_ROTATE_WAIT, Fluent::Plugin::TailInput::FilePositionEntry, any, true, true, true, 1000, any, any, any, any, any, any).once.and_return do
|
930
1022
|
flexmock('TailWatcher') { |watcher|
|
931
1023
|
watcher.should_receive(:attach).once
|
932
1024
|
watcher.should_receive(:unwatched=).zero_or_more_times
|
@@ -944,7 +1036,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
944
1036
|
|
945
1037
|
Timecop.freeze(2010, 1, 2, 3, 4, 6) do
|
946
1038
|
flexstub(Fluent::Plugin::TailInput::TailWatcher) do |watcherclass|
|
947
|
-
watcherclass.should_receive(:new).with('test/plugin/data/2010/01/20100102-030406.log', EX_ROTATE_WAIT, Fluent::Plugin::TailInput::FilePositionEntry, any, true, true, 1000, any, any, any, any, any, any).once.and_return do
|
1039
|
+
watcherclass.should_receive(:new).with('test/plugin/data/2010/01/20100102-030406.log', EX_ROTATE_WAIT, Fluent::Plugin::TailInput::FilePositionEntry, any, true, true, true, 1000, any, any, any, any, any, any).once.and_return do
|
948
1040
|
flexmock('TailWatcher') do |watcher|
|
949
1041
|
watcher.should_receive(:attach).once
|
950
1042
|
watcher.should_receive(:unwatched=).zero_or_more_times
|
data/test/plugin/test_in_udp.rb
CHANGED
@@ -55,6 +55,7 @@ class UdpInputTest < Test::Unit::TestCase
|
|
55
55
|
assert_equal PORT, d.instance.port
|
56
56
|
assert_equal bind, d.instance.bind
|
57
57
|
assert_equal 4096, d.instance.message_length_limit
|
58
|
+
assert_equal nil, d.instance.receive_buffer_size
|
58
59
|
end
|
59
60
|
|
60
61
|
data(
|
@@ -172,4 +173,37 @@ class UdpInputTest < Test::Unit::TestCase
|
|
172
173
|
assert_equal expected_record, d.events[i][2]
|
173
174
|
end
|
174
175
|
end
|
176
|
+
|
177
|
+
test 'receive_buffer_size' do
|
178
|
+
# doesn't check exact value because it depends on platform and condition
|
179
|
+
|
180
|
+
# check if default socket and in_udp's one without receive_buffer_size have same size buffer
|
181
|
+
d0 = create_driver(BASE_CONFIG + %!
|
182
|
+
format none
|
183
|
+
!)
|
184
|
+
d0.run do
|
185
|
+
sock = d0.instance.instance_variable_get(:@_servers)[0].server.instance_variable_get(:@sock)
|
186
|
+
begin
|
187
|
+
default_sock = UDPSocket.new
|
188
|
+
assert_equal(default_sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int, sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int)
|
189
|
+
ensure
|
190
|
+
default_sock.close
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# check if default socket and in_udp's one with receive_buffer_size have different size buffer
|
195
|
+
d1 = create_driver(BASE_CONFIG + %!
|
196
|
+
format none
|
197
|
+
receive_buffer_size 1001
|
198
|
+
!)
|
199
|
+
d1.run do
|
200
|
+
sock = d1.instance.instance_variable_get(:@_servers)[0].server.instance_variable_get(:@sock)
|
201
|
+
begin
|
202
|
+
default_sock = UDPSocket.new
|
203
|
+
assert_not_equal(default_sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int, sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int)
|
204
|
+
ensure
|
205
|
+
default_sock.close
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
175
209
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluentd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -152,14 +152,14 @@ dependencies:
|
|
152
152
|
requirements:
|
153
153
|
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 0.1
|
155
|
+
version: '0.1'
|
156
156
|
type: :runtime
|
157
157
|
prerelease: false
|
158
158
|
version_requirements: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
160
|
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: 0.1
|
162
|
+
version: '0.1'
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
164
|
name: ruby_dig
|
165
165
|
requirement: !ruby/object:Gem::Requirement
|