fluent-plugin-remote_syslog 0.3.1 → 0.3.2

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: fc10c8c7403883b27cca3def44bbaa3c75c652f8
4
- data.tar.gz: ea359618ac41bd7dcf70d5e57e2e28696cf3a5c4
3
+ metadata.gz: f5179d40ceead1e1bb25e858dfd2b0dedbe4e9cb
4
+ data.tar.gz: 8d3ba77a4b1d7f59c2214ccf82cc19f3e833901b
5
5
  SHA512:
6
- metadata.gz: b12a5eee1282139e3f856e8e61be8c46eda6c29c92a21a831b0d30fbed36e69dd30c782dd762875974fc8f13ab2507584305c7efeeb44b2a23fbb0856a00848b
7
- data.tar.gz: badffc390eced3fd16032c590e9d3c4ed3672098e2f5d26ee975cb4ba4eeea59f3d257d5c3f624987edb646f31a7c2aad3099d336057dd4a9372e83f607210a4
6
+ metadata.gz: 90968580bcdc9b5bf928f6aab35f867aa6d749fad5e8fb7163333cad5825d71bfc874bad771dea62b7ce8eae0d99c0a7887b03d00f405677abdada4261b7710b
7
+ data.tar.gz: 9ea571f77eac590be9e31d7c478e15002c5fde3efbe1d130fb4033ad103fef1522fd94655e9bf5f2b47481390ed916b19a50b110db0e66f4d8a59a8c50c66bf3
@@ -1,5 +1,10 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  rvm:
3
- - 1.9.3
4
5
  - 2.0.0
5
- - 2.1.0
6
+ - 2.1.8
7
+ - 2.2.4
8
+ - 2.3.0
9
+ before_install:
10
+ - gem update bundler
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -17,10 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_development_dependency "rake", "~> 10.0"
20
+ spec.add_development_dependency "test-unit-minitest"
21
+ spec.add_development_dependency "minitest"
20
22
 
21
23
  spec.add_runtime_dependency "fluentd"
22
24
  spec.add_runtime_dependency "fluent-mixin-plaintextformatter"
23
25
  spec.add_runtime_dependency "remote_syslog_logger", "~> 1.0.0"
24
- spec.add_runtime_dependency "fluent-mixin-config-placeholders", "~> 0.2.0"
26
+ spec.add_runtime_dependency "fluent-mixin-config-placeholders"
25
27
  spec.add_runtime_dependency "fluent-mixin-rewrite-tag-name"
26
28
  end
@@ -23,21 +23,12 @@ module Fluent
23
23
  def initialize
24
24
  super
25
25
  require "remote_syslog_logger"
26
- end
27
-
28
- def configure(conf)
29
- super
30
- @logger = RemoteSyslogLogger::UdpSender.new(@host,
31
- @port,
32
- facility: @facility,
33
- severity: @severity,
34
- program: @tag,
35
- local_hostname: @hostname)
26
+ @loggers = {}
36
27
  end
37
28
 
38
29
  def shutdown
39
30
  super
40
- @logger.close if @logger
31
+ @loggers.values.each(&:close)
41
32
  end
42
33
 
43
34
  def emit(tag, es, chain)
@@ -48,10 +39,16 @@ module Fluent
48
39
  v.force_encoding("utf-8")
49
40
  end
50
41
  end
51
- emit_tag = tag.dup
52
- filter_record(emit_tag, time, record)
53
42
 
54
- @logger.transmit format(tag, time, record)
43
+ tag = rewrite_tag!(tag.dup)
44
+ @loggers[tag] ||= RemoteSyslogLogger::UdpSender.new(@host,
45
+ @port,
46
+ facility: @facility,
47
+ severity: @severity,
48
+ program: tag,
49
+ local_hostname: @hostname)
50
+
51
+ @loggers[tag].transmit format(tag, time, record)
55
52
  end
56
53
  end
57
54
  end
@@ -1,36 +1,62 @@
1
1
  require "test_helper"
2
2
  require "fluent/plugin/out_remote_syslog"
3
3
 
4
- class RemoteSyslogOutputTest < Test::Unit::TestCase
4
+ class RemoteSyslogOutputTest < MiniTest::Unit::TestCase
5
5
  def setup
6
- super
7
6
  Fluent::Test.setup
8
7
  end
9
8
 
10
- CONFIG = %[
11
- type remote_syslog
12
- hostname foo.com
13
- host example.com
14
- port 5566
15
- severity debug
16
- tag testunit
17
- ]
18
-
19
- def create_driver(conf = CONFIG)
20
- Fluent::Test::OutputTestDriver.new(Fluent::RemoteSyslogOutput) {}.configure(conf)
9
+ def create_driver(conf = CONFIG, tag = "test.remote_syslog")
10
+ Fluent::Test::OutputTestDriver.new(Fluent::RemoteSyslogOutput, tag) {}.configure(conf)
21
11
  end
22
12
 
23
13
  def test_configure
24
- d = create_driver
25
- logger = d.instance.instance_variable_get(:@logger)
14
+ d = create_driver %[
15
+ type remote_syslog
16
+ hostname foo.com
17
+ host example.com
18
+ port 5566
19
+ severity debug
20
+ tag minitest
21
+ ]
22
+
23
+ d.run do
24
+ d.emit(message: "foo")
25
+ end
26
+
27
+ loggers = d.instance.instance_variable_get(:@loggers)
28
+ refute_empty loggers
29
+
30
+ logger = loggers.values.first
26
31
 
27
- assert_not_nil logger
28
32
  assert_equal "example.com", logger.instance_variable_get(:@remote_hostname)
29
33
  assert_equal 5566, logger.instance_variable_get(:@remote_port)
34
+
30
35
  p = logger.instance_variable_get(:@packet)
31
36
  assert_equal "foo.com", p.hostname
32
37
  assert_equal 1, p.facility
33
- assert_equal "testunit", p.tag
38
+ assert_equal "minitest", p.tag
34
39
  assert_equal 7, p.severity
35
40
  end
41
+
42
+ def test_rewrite_tag
43
+ d = create_driver %[
44
+ type remote_syslog
45
+ hostname foo.com
46
+ host example.com
47
+ port 5566
48
+ severity debug
49
+ tag rewrited.${tag_parts[1]}
50
+ ]
51
+
52
+ d.run do
53
+ d.emit(message: "foo")
54
+ end
55
+
56
+ loggers = d.instance.instance_variable_get(:@loggers)
57
+ logger = loggers.values.first
58
+
59
+ p = logger.instance_variable_get(:@packet)
60
+ assert_equal "rewrited.remote_syslog", p.tag
61
+ end
36
62
  end
@@ -1,5 +1,7 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
 
4
- require 'test/unit'
5
- require 'fluent/test'
4
+ require "minitest/autorun"
5
+ require "minitest/unit"
6
+ require "minitest/pride"
7
+ require "fluent/test"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-remote_syslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: test-unit-minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: fluentd
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +98,16 @@ dependencies:
70
98
  name: fluent-mixin-config-placeholders
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - "~>"
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: 0.2.0
103
+ version: '0'
76
104
  type: :runtime
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - "~>"
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: 0.2.0
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: fluent-mixin-rewrite-tag-name
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -140,4 +168,3 @@ summary: Fluentd output plugin for remote syslog
140
168
  test_files:
141
169
  - test/plugin/out_remote_syslog.rb
142
170
  - test/test_helper.rb
143
- has_rdoc: