fluent-plugin-syslog-tls 0.6.0 → 1.0.0

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: ddf273fb2c9a34084d8a7a1feb129bc1bbb1839b
4
- data.tar.gz: dfdc191ec721da7055e0378d1ce56cc0f6764a5c
3
+ metadata.gz: 194b7c338bc48c3b97b41d51f5258157f0bf4fd1
4
+ data.tar.gz: 340359e27afeac0a38eb705cfac9cdf5c123cd1e
5
5
  SHA512:
6
- metadata.gz: 4319df63af40e195d1d027103c520a93fba78919094a8d2b4cb6b29e0665eaed8a0342fc8c9c3c48f6daa73d5f31db96e0f3ec17cbd106f72870b0e024e1af3a
7
- data.tar.gz: cc5cfffaa6760872316e6952332dfaf2ba79691863fcde49d5ae81ad84672f94a5963d3d2c626f9a7c0b09284d9c2c768bb345558f2a9bf675834a78a3814a5e
6
+ metadata.gz: 66915ee3952bcc0eacd004e7b56bb3d7521bb2748c7921b0321dbac1ab09c8fcf356355e3b600287e13251cd545209cacd95edb6f579bfe382cba0309b88d14b
7
+ data.tar.gz: 8b2e05659598a9dc390350841455c9d003afa520e984de48f30d32974ea014c4b36e21c583edf60e3932cc9a4d0830f66cb32935f9d57d79ee5bb90e7533f847
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.rbc
3
3
  /.config
4
4
  /coverage/
5
+ /Gemfile.lock
5
6
  /InstalledFiles
6
7
  /pkg/
7
8
  /spec/reports/
@@ -29,8 +30,8 @@ build/
29
30
  # for a library or gem, you might want to ignore these files since the code is
30
31
  # intended to run in multiple environments; otherwise, check them in:
31
32
  # Gemfile.lock
32
- .ruby-version
33
- .ruby-gemset
33
+ # .ruby-version
34
+ # .ruby-gemset
34
35
 
35
36
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
37
  .rvmrc
data/README.md CHANGED
@@ -8,20 +8,18 @@ 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
- $ gem install fluent-plugin-syslog-tls -v '~> 0.6'
13
+ $ gem install fluent-plugin-syslog-tls
14
14
  ```
15
15
  or
16
16
  ```sh
17
- $ td-agent-gem install fluent-plugin-syslog-tls -v '~> 0.6'
17
+ $ td-agent-gem install fluent-plugin-syslog-tls
18
18
  ```
19
19
 
20
- _Hint: Use v0.5+ for Fluentd 0.12 and v1.0+ for Fluentd 0.14. (See Version Compatibility below.)_
21
-
22
20
 
23
21
  ## Configuration
24
-
22
+ ---
25
23
  In your Fluentd configuration, use `@type syslog_tls`. Examples:
26
24
 
27
25
  Sumologic:
@@ -48,21 +46,17 @@ Papertrail:
48
46
  For more configuration options see [configuration docs](docs/configuration.md)
49
47
 
50
48
 
51
- ## Version Compatibility
52
-
53
- * v0.x.x of this plugin is compatible with the Fluentd 0.12 series.
54
- * v1.x.x of this plugin is compatible with the Fluentd 0.14 series.
55
-
56
- Note that the v1.x series has more features and is more robust than the v0.x series.
57
-
58
-
59
49
  ## Origin/History
60
50
 
61
- This plugin is derived from [Fluent::Plugin::SumologicCloudSyslog](https://github.com/acquia/fluent-plugin-sumologic-cloud-syslog). Changes for the v0.x+ series are in this branch's [Changelog](CHANGELOG.md).
51
+ This plugin is derived from [Fluent::Plugin::SumologicCloudSyslog](https://github.com/acquia/fluent-plugin-sumologic-cloud-syslog). Changes from the original:
62
52
 
53
+ * Standard fluent formatting plugins are supported. Json output remains the default.
54
+ * `token` (Structured Data in syslog terms) is now optional, for syslog hosts that don't require it.
55
+ * Message payload in the syslog packet no longer duplicates Time or includes Tag by default.
63
56
 
64
- ## License
65
57
 
58
+ ## License
59
+ ---
66
60
  Except as otherwise noted this software is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
67
61
 
68
62
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,14 +15,6 @@ Host represents DNS name of endpoint where should be data sent. Example: `syslog
15
15
 
16
16
  Example: `6514`
17
17
 
18
- ### ca_cert
19
-
20
- Whether and how to verify the server's TLS certificate. Examples:
21
- * ca_cert system - Default; use the system CA certificate store (which must then be configured correctly)
22
- * ca_cert false - Disable verification; not recommended
23
- * ca_cert /path/to/file - A path+filename to a single CA file
24
- * ca_cert /path/to/dir/ - A directory of CA files (in format that OpenSSL can parse); must end with /
25
-
26
18
  ### token
27
19
 
28
20
  Some services require a token to identify the account. Example: `ABABABABABABA@99999`. Not required for Papertrail.
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.require_paths = ['lib']
33
33
  s.required_ruby_version = '>= 2.0.0'
34
34
 
35
- s.add_runtime_dependency 'fluentd', '~> 0.12.0'
35
+ s.add_runtime_dependency 'fluentd', '~> 0.12'
36
36
  s.add_runtime_dependency 'fluent-mixin-config-placeholders', '~> 0.3'
37
37
 
38
38
  s.add_development_dependency 'minitest', '~> 5.8'
@@ -23,11 +23,12 @@ module Fluent
23
23
  include Fluent::Mixin::ConfigPlaceholders
24
24
  include Fluent::HandleTagNameMixin
25
25
 
26
+ helpers :inject, :formatter, :compat_parameters
27
+
26
28
  DEFAULT_FORMAT_TYPE = 'json'
27
29
 
28
30
  config_param :host, :string
29
31
  config_param :port, :integer
30
- config_param :ca_cert, :string, default: 'system'
31
32
  config_param :token, :string, :default => nil
32
33
  config_param :cert, :string, :default => nil
33
34
  config_param :key, :string, :default => nil
@@ -43,7 +44,11 @@ module Fluent
43
44
  config_param "#{key_name}_key".to_sym, :string, :default => nil
44
45
  end
45
46
 
46
- config_param :format, :string, default: DEFAULT_FORMAT_TYPE
47
+ config_section :format do
48
+ config_set_default :@type, DEFAULT_FORMAT_TYPE
49
+ end
50
+
51
+ attr_accessor :formatter
47
52
 
48
53
 
49
54
  def initialize
@@ -59,6 +64,11 @@ module Fluent
59
64
 
60
65
  # This method is called before starting.
61
66
  def configure(conf)
67
+ if conf['output_type'] && !conf['format']
68
+ conf['format'] = conf['output_type']
69
+ end
70
+ compat_parameters_convert(conf, :inject, :formatter)
71
+
62
72
  super
63
73
  @host = conf['host']
64
74
  @port = conf['port']
@@ -72,8 +82,7 @@ module Fluent
72
82
  @mappings[key_name] = conf[conf_key] if conf.key?(conf_key)
73
83
  end
74
84
 
75
- @formatter = Plugin.new_formatter(@format)
76
- @formatter.configure(conf)
85
+ @formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE)
77
86
  end
78
87
 
79
88
  # Get logger for given tag
@@ -90,7 +99,7 @@ module Fluent
90
99
  end
91
100
 
92
101
  def new_logger(tag)
93
- transport = ::SyslogTls::SSLTransport.new(host, port, ca_cert: ca_cert, cert: cert, key: key, max_retries: 3)
102
+ transport = ::SyslogTls::SSLTransport.new(host, port, cert: cert, key: key, max_retries: 3)
94
103
  logger = ::SyslogTls::Logger.new(transport, token)
95
104
  logger.facility(facility)
96
105
  logger.hostname(hostname)
@@ -99,6 +108,7 @@ module Fluent
99
108
  end
100
109
 
101
110
  def format(tag, time, record)
111
+ record = inject_values_to_record(tag, time, record)
102
112
  @formatter.format(tag, time, record)
103
113
  end
104
114
 
@@ -20,12 +20,11 @@ module SyslogTls
20
20
  class SSLTransport
21
21
  attr_accessor :socket
22
22
 
23
- attr_reader :host, :port, :ca_cert, :cert, :key, :ssl_version
23
+ attr_reader :host, :port, :cert, :key, :ssl_version
24
24
 
25
25
  attr_writer :retries
26
26
 
27
- def initialize(host, port, ca_cert: 'system', cert: nil, key: nil, ssl_version: :TLSv1_2, max_retries: 1)
28
- @ca_cert = ca_cert
27
+ def initialize(host, port, cert: nil, key: nil, ssl_version: :TLSv1_2, max_retries: 1)
29
28
  @host = host
30
29
  @port = port
31
30
  @cert = cert
@@ -47,24 +46,9 @@ module SyslogTls
47
46
  ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)
48
47
  ctx.ssl_version = ssl_version
49
48
 
50
- case ca_cert
51
- when true, 'true', 'system'
52
- # use system certs, same as openssl cli
53
- ctx.cert_store = OpenSSL::X509::Store.new
54
- ctx.cert_store.set_default_paths
55
- when false, 'false'
56
- ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
57
- when %r{/$} # ends in /
58
- ctx.ca_path = ca_cert
59
- when String
60
- ctx.ca_file = ca_cert
61
- end
62
-
63
- ctx.cert = OpenSSL::X509::Certificate.new(File.read(cert)) if cert
64
- ctx.key = OpenSSL::PKey::read(File.read(key)) if key
65
- socket = OpenSSL::SSL::SSLSocket.new(tcp, ctx)
66
- socket.sync_close = true
67
- socket
49
+ ctx.cert = OpenSSL::X509::Certificate.new(File.open(cert)) if cert
50
+ ctx.key = OpenSSL::PKey::RSA.new(File.open(key)) if key
51
+ OpenSSL::SSL::SSLSocket.new(tcp, ctx)
68
52
  end
69
53
 
70
54
  # Allow to retry on failed writes
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module SyslogTls
17
- VERSION = '0.6.0'
17
+ VERSION = '1.0.0'
18
18
  end
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: 0.6.0
4
+ version: 1.0.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: 2017-08-07 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.0
19
+ version: '0.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.12.0
26
+ version: '0.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fluent-mixin-config-placeholders
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -132,9 +132,7 @@ files:
132
132
  - ".coveralls.yml"
133
133
  - ".gitignore"
134
134
  - ".travis.yml"
135
- - CHANGELOG.md
136
135
  - Gemfile
137
- - Gemfile.lock
138
136
  - LICENSE
139
137
  - README.md
140
138
  - Rakefile
@@ -174,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
172
  version: '0'
175
173
  requirements: []
176
174
  rubyforge_project:
177
- rubygems_version: 2.6.11
175
+ rubygems_version: 2.5.1
178
176
  signing_key:
179
177
  specification_version: 4
180
178
  summary: Fluent Syslog TLS output plugin
@@ -1,19 +0,0 @@
1
- Note: v0.5+ is compatible with Fluent 0.12. Use v1.0+ with Fluent 0.14.
2
-
3
- #### 0.6.0
4
- * Backport `ca_cert` from master to fluent-0.12 branch
5
- - Added `ca_cert` to validate the remote certificate. Defaults to 'system' which uses the system certificate store.
6
-
7
-
8
- #### 0.5.0
9
-
10
- Comparable to 1.0.0 from [master (Fluent 0.14) branch](https://github.com/zarqman/fluent-plugin-syslog-tls).
11
-
12
- * Standard fluent formatting plugins are supported. Json output remains the default.
13
- * `token` (Structured Data in syslog terms) is now optional, for syslog hosts that don't require it.
14
- * Message payload in the syslog packet no longer duplicates Time or includes Tag by default.
15
-
16
-
17
- #### < 0.2.0
18
-
19
- From [Fluent::Plugin::SumologicCloudSyslog](https://github.com/acquia/fluent-plugin-sumologic-cloud-syslog)
@@ -1,85 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- fluent-plugin-syslog-tls (0.6.0)
5
- fluent-mixin-config-placeholders (~> 0.3)
6
- fluentd (~> 0.12.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.5.1)
12
- public_suffix (~> 2.0, >= 2.0.2)
13
- cool.io (1.5.0)
14
- coveralls (0.8.21)
15
- json (>= 1.8, < 3)
16
- simplecov (~> 0.14.1)
17
- term-ansicolor (~> 1.3)
18
- thor (~> 0.19.4)
19
- tins (~> 1.6)
20
- crack (0.4.3)
21
- safe_yaml (~> 1.0.0)
22
- docile (1.1.5)
23
- fluent-mixin-config-placeholders (0.4.0)
24
- fluentd
25
- uuidtools (>= 2.1.5)
26
- fluentd (0.12.39)
27
- cool.io (>= 1.2.2, < 2.0.0)
28
- http_parser.rb (>= 0.5.1, < 0.7.0)
29
- json (>= 1.4.3)
30
- msgpack (>= 0.5.11, < 2)
31
- sigdump (~> 0.2.2)
32
- string-scrub (>= 0.0.3, <= 0.0.5)
33
- tzinfo (>= 1.0.0)
34
- tzinfo-data (>= 1.0.0)
35
- yajl-ruby (~> 1.0)
36
- hashdiff (0.3.5)
37
- http_parser.rb (0.6.0)
38
- json (2.1.0)
39
- minitest (5.10.3)
40
- minitest-stub_any_instance (1.0.1)
41
- msgpack (1.1.0)
42
- power_assert (1.0.2)
43
- public_suffix (2.0.5)
44
- rake (10.5.0)
45
- safe_yaml (1.0.4)
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.1)
52
- string-scrub (0.0.5)
53
- term-ansicolor (1.6.0)
54
- tins (~> 1.0)
55
- test-unit (3.2.5)
56
- power_assert
57
- thor (0.19.4)
58
- thread_safe (0.3.6)
59
- tins (1.15.0)
60
- tzinfo (1.2.3)
61
- thread_safe (~> 0.1)
62
- tzinfo-data (1.2017.2)
63
- tzinfo (>= 1.0.0)
64
- uuidtools (2.1.5)
65
- webmock (2.3.2)
66
- addressable (>= 2.3.6)
67
- crack (>= 0.3.2)
68
- hashdiff
69
- yajl-ruby (1.3.0)
70
-
71
- PLATFORMS
72
- ruby
73
-
74
- DEPENDENCIES
75
- coveralls
76
- fluent-plugin-syslog-tls!
77
- minitest (~> 5.8)
78
- minitest-stub_any_instance (~> 1.0.0)
79
- rake (~> 10.5)
80
- simplecov (~> 0.11)
81
- test-unit (~> 3.1)
82
- webmock (~> 2.0)
83
-
84
- BUNDLED WITH
85
- 1.14.6