fluent-plugin-keep-forward 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbe4023150376fbaded20b1341adb19c3d7c65c7
4
- data.tar.gz: cc46d27569ff273e64ac0436402811bfe20c134f
3
+ metadata.gz: dbbee68f0007b1260a98d7daa5f5c5cc948dae3c
4
+ data.tar.gz: 29e55d39b2ac8c062e896a4f52a55c7c98879165
5
5
  SHA512:
6
- metadata.gz: 931eeec156abc448a06edc8c23aa665bcdacee8ea01d2cc31f3c55a46bcd11b5623425dc3c8c48b00048696fcb5450beb5e4de045a6d4c2538d5d4f96bd3fa22
7
- data.tar.gz: 935f93bd171edc9aa7ea2f895f5f8ad8f01cc3de3e8990d4be12c022a8797aadae12a434d2b08f30625ecde2d5bcdcab7787876d8bc0d27e6a01a75a33162f99
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
- Exactly same with out\_forward plugin. See http://docs.fluentd.org/articles/out_forward
11
+ Basically same with out\_forward plugin. See http://docs.fluentd.org/articles/out_forward
12
12
 
13
- ## Log
13
+ ## Additional Parameters
14
14
 
15
- This plugin outputs log messages like
15
+ * prefer_recover
16
16
 
17
- $ grep 'keep forwarding' /var/log/td-agent/td-agent.log
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.3"
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? # and @weight_array.include?(@node[tag])
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(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::KeepForwardOutput, tag).configure(CONFIG).instance }
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 'switch if not included in weight_array?' do
53
- before { driver.instance_variable_set(:@weight_array, [unkeep_node]) }
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
- let(:target) { unkeep_node }
56
- it { driver.write_objects(tag, es) }
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.3
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-04-29 00:00:00.000000000 Z
11
+ date: 2013-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd