fluent-plugin-syslog-gobi-tls 2.1.28 → 2.1.29

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: 7588960a6c14e25d874b1621b23ccddeec6a68f7bdb6865190d27458d9ba8bb4
4
- data.tar.gz: c1c8dcb3ea00c5d36251c82551f8a5edc2ee2d01429c05ac9d0a8dab349c808b
3
+ metadata.gz: 3cd2b97fbf5538d79f925edfa2231254929ad80295ef137ddd1f6f18dc38ebd7
4
+ data.tar.gz: 708b7e494707863e469776e94c942f81d556c2b6ccdb84c7d5d24ee244ce8eb6
5
5
  SHA512:
6
- metadata.gz: b9bc4d9ffc76e3c518069991b88c6010448b1d1e50573e0c2fa1ed6dd96b29b999eb29c29641f0470c6fd5e2a9e518b4e482acdcbc801c09b39b1d6a940fafbb
7
- data.tar.gz: 1872801c5822904d6ae2c94ba9e86941deece593fd49e74608bef484606a2730eb27e96c40c30f2dba2ef2ea8487230276775b1dea2892787d3b2cd56564feaf
6
+ metadata.gz: a2b97e8aad0a0414ea98e9c31d2e59fa767333f3b15133fcbf702304e80bef1982745ddea8f7a191ab7f32fc29c437f8da679c1188f1285c95b533e4b12cfbd7
7
+ data.tar.gz: fb54c28711b00c1bdf00ef0e38f7c4609e4f7091ae87d8243e11bdf326b59de4d3aca0c6acab5384539e15c7fa4a17ae6cbdab78863d7c2d0143a6dedbf42ca3
data/.gitignore CHANGED
@@ -37,3 +37,4 @@ build/
37
37
 
38
38
  ## System
39
39
  .DS_Store
40
+ .vscode
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-syslog-tls (2.1.0.rc1)
4
+ fluent-plugin-syslog-tls (2.1.0)
5
5
  fluentd (>= 0.14.0, < 2)
6
6
 
7
7
  GEM
@@ -9,35 +9,41 @@ GEM
9
9
  specs:
10
10
  addressable (2.8.1)
11
11
  public_suffix (>= 2.0.2, < 6.0)
12
- concurrent-ruby (1.1.10)
13
- cool.io (1.7.1)
12
+ base64 (0.2.0)
13
+ concurrent-ruby (1.2.3)
14
+ cool.io (1.8.0)
14
15
  crack (0.4.5)
15
16
  rexml
17
+ csv (3.3.0)
16
18
  docile (1.4.0)
17
- fluentd (1.15.3)
19
+ drb (2.2.1)
20
+ fluentd (1.17.0)
21
+ base64 (~> 0.2)
18
22
  bundler
19
23
  cool.io (>= 1.4.5, < 2.0.0)
24
+ csv (~> 3.2)
25
+ drb (~> 2.2)
20
26
  http_parser.rb (>= 0.5.1, < 0.9.0)
21
27
  msgpack (>= 1.3.1, < 2.0.0)
22
- serverengine (>= 2.3.0, < 3.0.0)
23
- sigdump (~> 0.2.2)
28
+ serverengine (>= 2.3.2, < 3.0.0)
29
+ sigdump (~> 0.2.5)
24
30
  strptime (>= 0.2.4, < 1.0.0)
25
31
  tzinfo (>= 1.0, < 3.0)
26
32
  tzinfo-data (~> 1.0)
27
- webrick (>= 1.4.2, < 1.8.0)
33
+ webrick (~> 1.4)
28
34
  yajl-ruby (~> 1.0)
29
35
  hashdiff (1.0.1)
30
36
  http_parser.rb (0.8.0)
31
37
  minitest (5.17.0)
32
38
  minitest-stub_any_instance (1.0.3)
33
- msgpack (1.6.0)
39
+ msgpack (1.7.2)
34
40
  power_assert (2.0.3)
35
41
  public_suffix (5.0.1)
36
42
  rake (13.0.6)
37
43
  rexml (3.2.5)
38
- serverengine (2.3.1)
44
+ serverengine (2.3.2)
39
45
  sigdump (~> 0.2.2)
40
- sigdump (0.2.4)
46
+ sigdump (0.2.5)
41
47
  simplecov (0.22.0)
42
48
  docile (~> 1.1)
43
49
  simplecov-html (~> 0.11)
@@ -47,15 +53,15 @@ GEM
47
53
  strptime (0.2.5)
48
54
  test-unit (3.5.7)
49
55
  power_assert
50
- tzinfo (2.0.5)
56
+ tzinfo (2.0.6)
51
57
  concurrent-ruby (~> 1.0)
52
- tzinfo-data (1.2022.7)
58
+ tzinfo-data (1.2024.1)
53
59
  tzinfo (>= 1.0.0)
54
60
  webmock (3.18.1)
55
61
  addressable (>= 2.8.0)
56
62
  crack (>= 0.3.2)
57
63
  hashdiff (>= 0.4.0, < 2.0.0)
58
- webrick (1.7.0)
64
+ webrick (1.8.1)
59
65
  yajl-ruby (1.4.3)
60
66
 
61
67
  PLATFORMS
@@ -19,7 +19,7 @@ require 'syslog_tls/version'
19
19
 
20
20
  Gem::Specification.new do |s|
21
21
  s.name = 'fluent-plugin-syslog-gobi-tls'
22
- s.version = '2.1.28'
22
+ s.version = '2.1.29'
23
23
  s.authors = ['thomas morgan']
24
24
  s.email = ['tm@iprog.com']
25
25
  s.summary = %q{Fluent Syslog TLS output plugin}
@@ -16,6 +16,48 @@
16
16
  require 'socket'
17
17
  require 'syslog_tls/logger'
18
18
  require 'fluent/plugin/output'
19
+ require 'syslog_tls/host_backoff_specs'
20
+ require 'pp'
21
+
22
+ $host_backoff_specs_list = []
23
+
24
+ def add_host_backoff_spec(retries_to_do, host_ip_port)
25
+ # Check if an element with the same hostIPport already exists
26
+ return if $host_backoff_specs_list.any? { |spec| spec.hostIPport == host_ip_port }
27
+
28
+ # If not, add a new HostBackoffSpecs instance to the global array
29
+ $host_backoff_specs_list << ::SyslogTls::HostBackoffSpecs.new(retries_to_do, host_ip_port)
30
+ end
31
+
32
+ def can_write(host_ip_port)
33
+ begin
34
+ $host_backoff_specs_list.each do |backoff_specs|
35
+ if backoff_specs.hostIPport == host_ip_port
36
+ return backoff_specs.canwrite
37
+ end
38
+ end
39
+ rescue => e
40
+ pp "Error in can_write: #{e.message}"
41
+ return 0
42
+ end
43
+ return 1
44
+ end
45
+
46
+ def increase_retry(host_ip_port)
47
+ $host_backoff_specs_list.each do |backoff_specs|
48
+ if backoff_specs.hostIPport == host_ip_port
49
+ backoff_specs.failtowrite
50
+ end
51
+ end
52
+ end
53
+
54
+ def reset_tries(host_ip_port)
55
+ $host_backoff_specs_list.each do |backoff_specs|
56
+ if backoff_specs.hostIPport == host_ip_port
57
+ backoff_specs.resetRetries
58
+ end
59
+ end
60
+ end
19
61
 
20
62
  module Fluent::Plugin
21
63
  class SyslogTlsOutput < Output
@@ -82,6 +124,8 @@ module Fluent::Plugin
82
124
  @mappings[key_name] = conf[conf_key] if conf.key?(conf_key)
83
125
  end
84
126
 
127
+ add_host_backoff_spec(0, conf['host']+":"+conf['port'])
128
+
85
129
  @formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE)
86
130
  end
87
131
 
@@ -15,6 +15,7 @@
15
15
 
16
16
  require 'socket'
17
17
  require 'openssl'
18
+ require 'pp'
18
19
 
19
20
  module SyslogTls
20
21
  # Supports SSL connection to remote host
@@ -166,6 +167,8 @@ module SyslogTls
166
167
  end
167
168
 
168
169
  def select_with_timeout(tcp, type)
170
+ host_ip_port = host + ":" + port.to_s
171
+
169
172
  case type
170
173
  when :connect_read
171
174
  args = [[tcp], nil, nil, CONNECT_TIMEOUT]
@@ -178,7 +181,16 @@ module SyslogTls
178
181
  else
179
182
  raise "Unknown select type #{type}"
180
183
  end
181
- IO.select(*args) || raise("Socket timeout during #{type}")
184
+ if can_write(host_ip_port) == 1
185
+ if IO.select(*args)
186
+ reset_tries(host_ip_port)
187
+ else
188
+ increase_retry(host_ip_port)
189
+ raise("Socket timeout during #{type}")
190
+ end
191
+ else
192
+ raise("Failed to write #{type}")
193
+ end
182
194
  end
183
195
 
184
196
  # Forward any methods directly to SSLSocket
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-syslog-gobi-tls
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.28
4
+ version: 2.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan