fluent-plugin-syslog-tls 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -3
- data/CHANGELOG.md +14 -1
- data/Gemfile.lock +84 -0
- data/README.md +4 -4
- data/fluent-plugin-syslog-tls.gemspec +1 -2
- data/lib/fluent/plugin/out_syslog_tls.rb +6 -10
- data/lib/syslog_tls/protocol.rb +8 -3
- data/lib/syslog_tls/ssl_transport.rb +1 -1
- data/lib/syslog_tls/version.rb +1 -1
- data/test/fluent/test_out_syslog_tls.rb +15 -25
- data/test/helper.rb +0 -6
- metadata +8 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 324422e8c80df4ca6f7e9f1ad4cf14d96ad189a1
|
4
|
+
data.tar.gz: 69868f4d0613caa60ea5b931991111c1265996c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afb23e11616650e54e81c0053aa144549166f1db125abce497f3c4cf2804d382e2a9b210b9175148b87615eccb2019485b470b29da8d35219279bb24c840c292
|
7
|
+
data.tar.gz: 7e2956875721d149ead943fce796df6dc5ef277a996f8d16b1632b3c095cae3d54c7eeaf606a8f23a7a657575bc217b0dfd6cf18ab49a6fedffa95ed2da54f31
|
data/.gitignore
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
*.rbc
|
3
3
|
/.config
|
4
4
|
/coverage/
|
5
|
-
/Gemfile.lock
|
6
5
|
/InstalledFiles
|
7
6
|
/pkg/
|
8
7
|
/spec/reports/
|
@@ -30,8 +29,8 @@ build/
|
|
30
29
|
# for a library or gem, you might want to ignore these files since the code is
|
31
30
|
# intended to run in multiple environments; otherwise, check them in:
|
32
31
|
# Gemfile.lock
|
33
|
-
|
34
|
-
|
32
|
+
.ruby-version
|
33
|
+
.ruby-gemset
|
35
34
|
|
36
35
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
36
|
.rvmrc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#### 1.2.0
|
2
|
+
|
3
|
+
* Improve compliance with Fluentd 0.14 API.
|
4
|
+
* Eliminate excess Message#header object creation.
|
5
|
+
|
6
|
+
|
1
7
|
#### 1.1.0
|
2
8
|
|
3
9
|
* Renamed `cert` and `key` to `client_cert` and `client_key` respectively.
|
@@ -11,7 +17,14 @@
|
|
11
17
|
* Standard fluent formatting plugins are supported. Json output remains the default.
|
12
18
|
* `token` (Structured Data in syslog terms) is now optional, for syslog hosts that don't require it.
|
13
19
|
* Message payload in the syslog packet no longer duplicates Time or includes Tag by default.
|
20
|
+
* Requires Fluent 0.14.
|
21
|
+
|
22
|
+
|
23
|
+
#### 0.5.0
|
24
|
+
|
25
|
+
Comparable to v1.0.0, but compatible with Fluent 0.12.
|
26
|
+
|
14
27
|
|
28
|
+
#### < 0.2.0
|
15
29
|
|
16
|
-
#### < 1.0.0
|
17
30
|
From [Fluent::Plugin::SumologicCloudSyslog](https://github.com/acquia/fluent-plugin-sumologic-cloud-syslog)
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-syslog-tls (1.2.0)
|
5
|
+
fluentd (~> 0.14.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
cool.io (1.5.3)
|
13
|
+
coveralls (0.8.21)
|
14
|
+
json (>= 1.8, < 3)
|
15
|
+
simplecov (~> 0.14.1)
|
16
|
+
term-ansicolor (~> 1.3)
|
17
|
+
thor (~> 0.19.4)
|
18
|
+
tins (~> 1.6)
|
19
|
+
crack (0.4.3)
|
20
|
+
safe_yaml (~> 1.0.0)
|
21
|
+
docile (1.1.5)
|
22
|
+
fluentd (0.14.24)
|
23
|
+
cool.io (>= 1.4.5, < 2.0.0)
|
24
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
25
|
+
msgpack (>= 0.7.0, < 2.0.0)
|
26
|
+
ruby_dig (~> 0.0.2)
|
27
|
+
serverengine (>= 2.0.4, < 3.0.0)
|
28
|
+
sigdump (~> 0.2.2)
|
29
|
+
strptime (~> 0.1.7)
|
30
|
+
tzinfo (~> 1.0)
|
31
|
+
tzinfo-data (~> 1.0)
|
32
|
+
yajl-ruby (~> 1.0)
|
33
|
+
hashdiff (0.3.7)
|
34
|
+
http_parser.rb (0.6.0)
|
35
|
+
json (2.1.0)
|
36
|
+
minitest (5.10.3)
|
37
|
+
minitest-stub_any_instance (1.0.1)
|
38
|
+
msgpack (1.1.0)
|
39
|
+
power_assert (1.1.1)
|
40
|
+
public_suffix (3.0.1)
|
41
|
+
rake (12.3.0)
|
42
|
+
ruby_dig (0.0.2)
|
43
|
+
safe_yaml (1.0.4)
|
44
|
+
serverengine (2.0.5)
|
45
|
+
sigdump (~> 0.2.2)
|
46
|
+
sigdump (0.2.4)
|
47
|
+
simplecov (0.14.1)
|
48
|
+
docile (~> 1.1.0)
|
49
|
+
json (>= 1.8, < 3)
|
50
|
+
simplecov-html (~> 0.10.0)
|
51
|
+
simplecov-html (0.10.2)
|
52
|
+
strptime (0.1.9)
|
53
|
+
term-ansicolor (1.6.0)
|
54
|
+
tins (~> 1.0)
|
55
|
+
test-unit (3.2.6)
|
56
|
+
power_assert
|
57
|
+
thor (0.19.4)
|
58
|
+
thread_safe (0.3.6)
|
59
|
+
tins (1.16.0)
|
60
|
+
tzinfo (1.2.4)
|
61
|
+
thread_safe (~> 0.1)
|
62
|
+
tzinfo-data (1.2017.3)
|
63
|
+
tzinfo (>= 1.0.0)
|
64
|
+
webmock (2.3.2)
|
65
|
+
addressable (>= 2.3.6)
|
66
|
+
crack (>= 0.3.2)
|
67
|
+
hashdiff
|
68
|
+
yajl-ruby (1.3.1)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
coveralls
|
75
|
+
fluent-plugin-syslog-tls!
|
76
|
+
minitest (~> 5.8)
|
77
|
+
minitest-stub_any_instance (~> 1.0.0)
|
78
|
+
rake
|
79
|
+
simplecov (~> 0.11)
|
80
|
+
test-unit (~> 3.1)
|
81
|
+
webmock (~> 2.0)
|
82
|
+
|
83
|
+
BUNDLED WITH
|
84
|
+
1.15.4
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Tested with [Papertrail](https://papertrailapp.com) and should also work with [S
|
|
8
8
|
|
9
9
|
|
10
10
|
## Installation
|
11
|
-
|
11
|
+
|
12
12
|
```sh
|
13
13
|
$ gem install fluent-plugin-syslog-tls
|
14
14
|
```
|
@@ -17,11 +17,11 @@ or
|
|
17
17
|
$ td-agent-gem install fluent-plugin-syslog-tls
|
18
18
|
```
|
19
19
|
|
20
|
-
Note: `fluent-plugin-syslog-tls` is compatible with Fluent 0.14.
|
20
|
+
Note: `fluent-plugin-syslog-tls` is compatible with Fluent 0.14. For Fluent 0.12, see the `fluent-0.12` branch.
|
21
21
|
|
22
22
|
|
23
23
|
## Configuration
|
24
|
-
|
24
|
+
|
25
25
|
In your Fluentd configuration, use `@type syslog_tls`. Examples:
|
26
26
|
|
27
27
|
Sumologic:
|
@@ -54,7 +54,7 @@ This plugin is derived from [Fluent::Plugin::SumologicCloudSyslog](https://githu
|
|
54
54
|
|
55
55
|
|
56
56
|
## License
|
57
|
-
|
57
|
+
|
58
58
|
Except as otherwise noted this software is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
|
59
59
|
|
60
60
|
Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -33,11 +33,10 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.required_ruby_version = '>= 2.3.0'
|
34
34
|
|
35
35
|
s.add_runtime_dependency 'fluentd', '~> 0.14.0'
|
36
|
-
s.add_runtime_dependency 'fluent-mixin-config-placeholders', '~> 0.3'
|
37
36
|
|
38
37
|
s.add_development_dependency 'minitest', '~> 5.8'
|
39
38
|
s.add_development_dependency 'minitest-stub_any_instance', '~> 1.0.0'
|
40
|
-
s.add_development_dependency 'rake'
|
39
|
+
s.add_development_dependency 'rake'
|
41
40
|
s.add_development_dependency 'test-unit', '~> 3.1'
|
42
41
|
s.add_development_dependency 'webmock', '~> 2.0'
|
43
42
|
s.add_development_dependency 'simplecov', '~> 0.11'
|
@@ -13,16 +13,14 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require 'fluent/mixin/config_placeholders'
|
17
16
|
require 'socket'
|
17
|
+
require 'syslog_tls/logger'
|
18
|
+
require 'fluent/plugin/output'
|
18
19
|
|
19
|
-
module Fluent
|
20
|
-
class SyslogTlsOutput <
|
20
|
+
module Fluent::Plugin
|
21
|
+
class SyslogTlsOutput < Output
|
21
22
|
Fluent::Plugin.register_output('syslog_tls', self)
|
22
23
|
|
23
|
-
include Fluent::Mixin::ConfigPlaceholders
|
24
|
-
include Fluent::HandleTagNameMixin
|
25
|
-
|
26
24
|
helpers :inject, :formatter, :compat_parameters
|
27
25
|
|
28
26
|
DEFAULT_FORMAT_TYPE = 'json'
|
@@ -55,13 +53,12 @@ module Fluent
|
|
55
53
|
|
56
54
|
def initialize
|
57
55
|
super
|
58
|
-
require 'syslog_tls/logger'
|
59
56
|
@loggers = {}
|
60
57
|
end
|
61
58
|
|
62
59
|
def shutdown
|
63
|
-
super
|
64
60
|
@loggers.values.each(&:close)
|
61
|
+
super
|
65
62
|
end
|
66
63
|
|
67
64
|
# This method is called before starting.
|
@@ -114,8 +111,7 @@ module Fluent
|
|
114
111
|
@formatter.format(tag, time, record)
|
115
112
|
end
|
116
113
|
|
117
|
-
def
|
118
|
-
chain.next
|
114
|
+
def process(tag, es)
|
119
115
|
es.each do |time, record|
|
120
116
|
record.each_pair do |_, v|
|
121
117
|
v.force_encoding('utf-8') if v.is_a?(String)
|
data/lib/syslog_tls/protocol.rb
CHANGED
@@ -25,7 +25,8 @@ module SyslogTls
|
|
25
25
|
|
26
26
|
# All headers by specification wrapped in single object
|
27
27
|
class Header
|
28
|
-
attr_accessor :
|
28
|
+
attr_accessor :version, :hostname, :app_name, :procid, :msgid
|
29
|
+
attr_reader :facility, :severity, :timestamp
|
29
30
|
|
30
31
|
FACILITIES = {}
|
31
32
|
SEVERITIES = {}
|
@@ -110,12 +111,16 @@ module SyslogTls
|
|
110
111
|
|
111
112
|
# Message represents full message that can be sent to syslog
|
112
113
|
class Message
|
113
|
-
attr_accessor :
|
114
|
+
attr_accessor :structured_data, :msg
|
115
|
+
attr_writer :header
|
114
116
|
|
115
117
|
def initialize
|
116
118
|
@msg = ''
|
117
119
|
@structured_data = []
|
118
|
-
|
120
|
+
end
|
121
|
+
|
122
|
+
def header
|
123
|
+
@header ||= Header.new
|
119
124
|
end
|
120
125
|
|
121
126
|
def assemble
|
data/lib/syslog_tls/version.rb
CHANGED
@@ -18,6 +18,7 @@ require 'ssl'
|
|
18
18
|
require 'date'
|
19
19
|
require 'minitest/mock'
|
20
20
|
require 'fluent/plugin/out_syslog_tls'
|
21
|
+
require 'fluent/test/driver/output'
|
21
22
|
|
22
23
|
class SyslogTlsOutputTest < Test::Unit::TestCase
|
23
24
|
include SSLTestHelper
|
@@ -27,8 +28,8 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
27
28
|
@driver = nil
|
28
29
|
end
|
29
30
|
|
30
|
-
def driver(
|
31
|
-
@driver ||= Fluent::Test::
|
31
|
+
def driver(conf='')
|
32
|
+
@driver ||= Fluent::Test::Driver::Output.new(Fluent::Plugin::SyslogTlsOutput).configure(conf)
|
32
33
|
end
|
33
34
|
|
34
35
|
def sample_record
|
@@ -45,7 +46,7 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
45
46
|
def mock_logger(token='TOKEN')
|
46
47
|
io = StringIO.new
|
47
48
|
io.set_encoding('utf-8')
|
48
|
-
|
49
|
+
::SyslogTls::Logger.new(io, token)
|
49
50
|
end
|
50
51
|
|
51
52
|
def test_configure
|
@@ -56,7 +57,7 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
56
57
|
client_key
|
57
58
|
token 1234567890
|
58
59
|
}
|
59
|
-
instance = driver(
|
60
|
+
instance = driver(config).instance
|
60
61
|
|
61
62
|
assert_equal 'syslog.collection.us1.sumologic.com', instance.host
|
62
63
|
assert_equal '6514', instance.port
|
@@ -72,16 +73,14 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
72
73
|
client_cert
|
73
74
|
client_key
|
74
75
|
}
|
75
|
-
instance = driver(
|
76
|
+
instance = driver(config).instance
|
76
77
|
|
77
78
|
time = Time.now
|
78
79
|
record = sample_record
|
79
80
|
logger = mock_logger(instance.token)
|
80
81
|
|
81
82
|
instance.stub(:new_logger, logger) do
|
82
|
-
|
83
|
-
chain.expect(:next, nil)
|
84
|
-
instance.emit('test', {time.to_i => record}, chain)
|
83
|
+
instance.process('test', {time.to_i => record})
|
85
84
|
end
|
86
85
|
|
87
86
|
assert_equal "<134>1 #{time.to_datetime.rfc3339} - - - - - #{record.to_json.to_s}\n\n", logger.transport.string
|
@@ -99,16 +98,14 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
99
98
|
app_name_key app_name
|
100
99
|
msgid_key msgid
|
101
100
|
}
|
102
|
-
instance = driver(
|
101
|
+
instance = driver(config).instance
|
103
102
|
|
104
103
|
time = Time.now
|
105
104
|
record = sample_record
|
106
105
|
logger = mock_logger
|
107
106
|
|
108
107
|
instance.stub(:new_logger, logger) do
|
109
|
-
|
110
|
-
chain.expect(:next, nil)
|
111
|
-
instance.emit('test', {time.to_i => record}, chain)
|
108
|
+
instance.process('test', {time.to_i => record})
|
112
109
|
end
|
113
110
|
|
114
111
|
assert_true logger.transport.string.start_with?("<134>1 #{time.to_datetime.rfc3339} host app #{$$} 1000 [TOKEN]")
|
@@ -123,16 +120,14 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
123
120
|
token 1234567890
|
124
121
|
severity_key severity
|
125
122
|
}
|
126
|
-
instance = driver(
|
123
|
+
instance = driver(config).instance
|
127
124
|
|
128
125
|
time = Time.now
|
129
126
|
record = sample_record
|
130
127
|
logger = mock_logger
|
131
128
|
|
132
129
|
instance.stub(:new_logger, logger) do
|
133
|
-
|
134
|
-
chain.expect(:next, nil)
|
135
|
-
instance.emit('test', {time.to_i => record}, chain)
|
130
|
+
instance.process('test', {time.to_i => record})
|
136
131
|
end
|
137
132
|
|
138
133
|
assert_true logger.transport.string.start_with?("<128>1")
|
@@ -148,16 +143,14 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
148
143
|
format out_file
|
149
144
|
localtime false
|
150
145
|
}
|
151
|
-
instance = driver(
|
146
|
+
instance = driver(config).instance
|
152
147
|
|
153
148
|
time = Time.now
|
154
149
|
record = sample_record
|
155
150
|
logger = mock_logger
|
156
151
|
|
157
152
|
instance.stub(:new_logger, logger) do
|
158
|
-
|
159
|
-
chain.expect(:next, nil)
|
160
|
-
instance.emit('test', {time.to_i => record}, chain)
|
153
|
+
instance.process('test', {time.to_i => record})
|
161
154
|
end
|
162
155
|
|
163
156
|
formatted_time = time.dup.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
|
@@ -186,13 +179,10 @@ class SyslogTlsOutputTest < Test::Unit::TestCase
|
|
186
179
|
app_name_key app_name
|
187
180
|
msgid_key msgid
|
188
181
|
}
|
189
|
-
instance = driver(
|
190
|
-
|
191
|
-
chain = Minitest::Mock.new
|
192
|
-
chain.expect(:next, nil)
|
182
|
+
instance = driver(config).instance
|
193
183
|
|
194
184
|
SyslogTls::SSLTransport.stub_any_instance(:get_ssl_connection, ssl_client) do
|
195
|
-
instance.
|
185
|
+
instance.process('test', {time.to_i => record})
|
196
186
|
end
|
197
187
|
|
198
188
|
st.join
|
data/test/helper.rb
CHANGED
@@ -19,12 +19,6 @@ SimpleCov.start
|
|
19
19
|
|
20
20
|
Coveralls.wear! if ENV['TRAVIS']
|
21
21
|
|
22
|
-
# Fluentd sets default encoding to ASCII-8BIT, but coverall can load git data which can contain UTF-8 characters
|
23
|
-
at_exit do
|
24
|
-
Encoding.default_internal = 'UTF-8' if defined?(Encoding) && Encoding.respond_to?(:default_internal)
|
25
|
-
Encoding.default_external = 'UTF-8' if defined?(Encoding) && Encoding.respond_to?(:default_external)
|
26
|
-
end
|
27
|
-
|
28
22
|
require 'test/unit'
|
29
23
|
require 'fluent/test'
|
30
24
|
require 'minitest/pride'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-syslog-tls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thomas morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.14.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: fluent-mixin-config-placeholders
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.3'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.3'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: minitest
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +56,16 @@ dependencies:
|
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: test-unit
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +120,7 @@ files:
|
|
134
120
|
- ".travis.yml"
|
135
121
|
- CHANGELOG.md
|
136
122
|
- Gemfile
|
123
|
+
- Gemfile.lock
|
137
124
|
- LICENSE
|
138
125
|
- README.md
|
139
126
|
- Rakefile
|
@@ -173,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
160
|
version: '0'
|
174
161
|
requirements: []
|
175
162
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
163
|
+
rubygems_version: 2.6.13
|
177
164
|
signing_key:
|
178
165
|
specification_version: 4
|
179
166
|
summary: Fluent Syslog TLS output plugin
|