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 +4 -4
- data/.travis.yml +7 -2
- data/VERSION +1 -1
- data/fluent-plugin-remote_syslog.gemspec +3 -1
- data/lib/fluent/plugin/out_remote_syslog.rb +11 -14
- data/test/plugin/out_remote_syslog.rb +43 -17
- data/test/test_helper.rb +5 -3
- metadata +34 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5179d40ceead1e1bb25e858dfd2b0dedbe4e9cb
|
4
|
+
data.tar.gz: 8d3ba77a4b1d7f59c2214ccf82cc19f3e833901b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90968580bcdc9b5bf928f6aab35f867aa6d749fad5e8fb7163333cad5825d71bfc874bad771dea62b7ce8eae0d99c0a7887b03d00f405677abdada4261b7710b
|
7
|
+
data.tar.gz: 9ea571f77eac590be9e31d7c478e15002c5fde3efbe1d130fb4033ad103fef1522fd94655e9bf5f2b47481390ed916b19a50b110db0e66f4d8a59a8c50c66bf3
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
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"
|
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
|
-
|
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
|
-
@
|
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
|
-
|
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 <
|
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
|
-
|
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
|
-
|
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 "
|
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
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
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.
|
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:
|
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
|
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
|
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:
|