fluent-plugin-ssl-check 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db98f212ffba0fa6f4caad4e3dcedb88da99d298f1ee2f2e71a42374fdca90df
4
- data.tar.gz: 301dcadeb5f03df68afab76dd3a8c170fea09cb6bd5e5eab5a7d79aa204cf794
3
+ metadata.gz: acb92c3a49bddffabb4e0c3a18903f4d1e4ebabb0a4bde9e4822fd4726c86bc7
4
+ data.tar.gz: a4490494cc312a493be34012b70ec1f0d584bc3461d969f7b4c22711a1f57727
5
5
  SHA512:
6
- metadata.gz: 1efffe3228c31202824cbfb64e85b9c0a72cb54ecf618b23f5270c6f834b41005134df4f2c6880ba53fa84f2aac4763e05084f34dae35c7ee2e964c13e6f2a42
7
- data.tar.gz: 2d993e6609baccf618080b6ec80d764db82a81e5321f6485687ac874c16ab483f0c288a96c8f71ca6a0a3fcf4d68d37bdd1ed26afcb1621ae6b6c42912cbe8bf
6
+ metadata.gz: 0c7eb0483748e41e824eceb5cdbeae2e6ec911b5ced44f3b3748bec530f095eee01a9ee2028731d6b80d2c7cedd2b57b831b7fc77ac2abc89c761a8bebe41aa8
7
+ data.tar.gz: 0b50f77e08b75158651b553f18c9acb1497bf4ced4d0b95862fd1f034fb67fa10b4df5cd261b1c2f15bdde2d3d300ff5712182b89115a2b897124910bcebedc1
data/.rubocop.yml CHANGED
@@ -8,6 +8,11 @@ AllCops:
8
8
  Gemspec/DevelopmentDependencies:
9
9
  Enabled: false
10
10
 
11
+ Metrics/AbcSize:
12
+ Max: 40
13
+ # Exclude:
14
+ # - lib/fluent/plugin/in_ssl_check.rb
15
+
11
16
  Metrics/BlockLength:
12
17
  Exclude:
13
18
  - fluent-plugin-ssl-check.gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-ssl-check (1.0.0)
4
+ fluent-plugin-ssl-check (1.1.0)
5
5
  fluentd (>= 0.14.10, < 2)
6
6
 
7
7
  GEM
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fluent-plugin-ssl-check'
8
- spec.version = '1.0.0'
8
+ spec.version = '1.1.0'
9
9
  spec.authors = ['Thomas Tych']
10
10
  spec.email = ['thomas.tych@gmail.com']
11
11
 
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
3
+ # extensions for Time class
4
+ # provides formater
5
+ # - to epoch millisecond format
6
+ # - to iso format with millisecond
4
7
  class Time
5
8
  def to_epochmillis
6
9
  (to_f * 1000).to_i
@@ -69,7 +69,7 @@ module Fluent
69
69
 
70
70
  helpers :timer
71
71
 
72
- # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
72
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
73
73
  def configure(conf)
74
74
  super
75
75
 
@@ -86,7 +86,7 @@ module Fluent
86
86
  timeout: timeout
87
87
  )
88
88
  end
89
- # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
89
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
90
90
 
91
91
  def start
92
92
  super
@@ -116,6 +116,7 @@ module Fluent
116
116
  'ssl_not_after' => ssl_info.not_after,
117
117
  'expire_in_days' => ssl_info.expire_in_days
118
118
  }
119
+ record.update('error_class' => ssl_info.error_class) if ssl_info.error_class
119
120
  router.emit(tag, Fluent::EventTime.from_time(ssl_info.time), record)
120
121
  end
121
122
 
@@ -124,7 +125,6 @@ module Fluent
124
125
  emit_metric_expirency(ssl_info)
125
126
  end
126
127
 
127
- # rubocop:disable Metrics/AbcSize
128
128
  def emit_metric_status(ssl_info)
129
129
  record = {
130
130
  'timestamp' => ssl_info.time.send("to_#{timestamp_format}"),
@@ -138,7 +138,6 @@ module Fluent
138
138
  }
139
139
  router.emit(tag, Fluent::EventTime.from_time(ssl_info.time), record)
140
140
  end
141
- # rubocop:enable Metrics/AbcSize
142
141
 
143
142
  def emit_metric_expirency(ssl_info)
144
143
  return if ssl_info.error
@@ -193,6 +192,12 @@ module Fluent
193
192
 
194
193
  OK
195
194
  end
195
+
196
+ def error_class
197
+ return unless error
198
+
199
+ error.class.to_s
200
+ end
196
201
  end
197
202
 
198
203
  # ssl client
@@ -208,7 +213,6 @@ module Fluent
208
213
  @timeout = timeout
209
214
  end
210
215
 
211
- # rubocop:disable Metrics/AbcSize
212
216
  def ssl_info
213
217
  info = SslInfo.new
214
218
  begin
@@ -225,11 +229,10 @@ module Fluent
225
229
  info.ssl_version = ssl_socket.ssl_version
226
230
  end
227
231
  rescue StandardError => e
228
- info.error = e.to_s
232
+ info.error = e
229
233
  end
230
234
  info
231
235
  end
232
- # rubocop:enable Metrics/AbcSize
233
236
 
234
237
  def store
235
238
  OpenSSL::X509::Store.new.tap do |store|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-ssl-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Tych