fluent-plugin-keep-forward 0.0.3 → 0.0.4
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/README.md +4 -7
- data/fluent-plugin-keep-forward.gemspec +1 -1
- data/lib/fluent/plugin/out_keep_forward.rb +3 -1
- data/spec/out_keep_forward_spec.rb +25 -5
- 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: dbbee68f0007b1260a98d7daa5f5c5cc948dae3c
|
4
|
+
data.tar.gz: 29e55d39b2ac8c062e896a4f52a55c7c98879165
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5feef720bd183dff7b0abcb778246d4176700f94aee5520f519a19211c9783161977822943fc76f340f3fc18e9d0ebb1a8d8cefd106f0ab123c7d46b8c99862
|
7
|
+
data.tar.gz: 5d955251c44825f448be0d9fb969b58ed7c2b1611367cc5b01591e8af176b7c22066fa16e6fc072d6345a6413248b11128300441a85dcc405cf5f847d1d022b1
|
data/README.md
CHANGED
@@ -8,16 +8,13 @@ This is an extension of fluentd out\_forward plugin to keep fowarding log data t
|
|
8
8
|
|
9
9
|
## Configuration
|
10
10
|
|
11
|
-
|
11
|
+
Basically same with out\_forward plugin. See http://docs.fluentd.org/articles/out_forward
|
12
12
|
|
13
|
-
##
|
13
|
+
## Additional Parameters
|
14
14
|
|
15
|
-
|
15
|
+
* prefer_recover
|
16
16
|
|
17
|
-
|
18
|
-
2013-03-15 10:35:06 +0900: keep forwarding tag 'fluent.info' to node 'localhost:24224' host="localhost" port=24224 weight=60
|
19
|
-
|
20
|
-
You can tell the address of current forwarding node easily.
|
17
|
+
Switch to a recovered node from standby nodes or less weighted nodes. Default is `true`.
|
21
18
|
|
22
19
|
## Contributing
|
23
20
|
|
@@ -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-keep-forward"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.4"
|
7
7
|
s.authors = ["Naotoshi SEO"]
|
8
8
|
s.email = ["sonots@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/sonots/fluent-plugin-keep-forward"
|
@@ -3,9 +3,11 @@ require 'fluent/plugin/out_forward'
|
|
3
3
|
class Fluent::KeepForwardOutput < Fluent::ForwardOutput
|
4
4
|
Fluent::Plugin.register_output('keep_forward', self)
|
5
5
|
|
6
|
+
config_param :prefer_recover, :bool, :default => true
|
7
|
+
|
6
8
|
def write_objects(tag, es)
|
7
9
|
@node ||= {}
|
8
|
-
if @node[tag] and @node[tag].available?
|
10
|
+
if @node[tag] and @node[tag].available? and (!@prefer_recover or @weight_array.include?(@node[tag]))
|
9
11
|
begin
|
10
12
|
send_data(@node[tag], tag, es)
|
11
13
|
return
|
@@ -15,7 +15,8 @@ shared_context 'keep_forward_init' do
|
|
15
15
|
]
|
16
16
|
let(:tag) { 'syslog.host1' }
|
17
17
|
let(:es) { Object.new }
|
18
|
-
let(:
|
18
|
+
let(:config) { CONFIG }
|
19
|
+
let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::KeepForwardOutput, tag).configure(config).instance }
|
19
20
|
end
|
20
21
|
|
21
22
|
shared_context 'keep_forward_try_once' do
|
@@ -49,11 +50,30 @@ describe Fluent::KeepForwardOutput do
|
|
49
50
|
it { driver.write_objects(tag, es) }
|
50
51
|
end
|
51
52
|
|
52
|
-
describe '
|
53
|
-
|
53
|
+
describe 'not included in weight_array?' do
|
54
|
+
context "switch if recover true" do
|
55
|
+
let(:config) {
|
56
|
+
CONFIG + %[
|
57
|
+
prefer_recover true
|
58
|
+
]
|
59
|
+
}
|
60
|
+
before { driver.instance_variable_set(:@weight_array, [unkeep_node]) }
|
54
61
|
|
55
|
-
|
56
|
-
|
62
|
+
let(:target) { unkeep_node }
|
63
|
+
it { driver.write_objects(tag, es) }
|
64
|
+
end
|
65
|
+
|
66
|
+
context "not switch if recorver false" do
|
67
|
+
let(:config) {
|
68
|
+
CONFIG + %[
|
69
|
+
prefer_recover false
|
70
|
+
]
|
71
|
+
}
|
72
|
+
before { driver.instance_variable_set(:@weight_array, [unkeep_node]) }
|
73
|
+
|
74
|
+
let(:target) { keep_node }
|
75
|
+
it { driver.write_objects(tag, es) }
|
76
|
+
end
|
57
77
|
end
|
58
78
|
|
59
79
|
describe 'switch if send_data to keep_node raises?' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-keep-forward
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|