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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +19 -13
- data/fluent-plugin-syslog-tls.gemspec +1 -1
- data/lib/fluent/plugin/out_syslog_tls.rb +44 -0
- data/lib/syslog_tls/ssl_transport.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd2b97fbf5538d79f925edfa2231254929ad80295ef137ddd1f6f18dc38ebd7
|
4
|
+
data.tar.gz: 708b7e494707863e469776e94c942f81d556c2b6ccdb84c7d5d24ee244ce8eb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2b97e8aad0a0414ea98e9c31d2e59fa767333f3b15133fcbf702304e80bef1982745ddea8f7a191ab7f32fc29c437f8da679c1188f1285c95b533e4b12cfbd7
|
7
|
+
data.tar.gz: fb54c28711b00c1bdf00ef0e38f7c4609e4f7091ae87d8243e11bdf326b59de4d3aca0c6acab5384539e15c7fa4a17ae6cbdab78863d7c2d0143a6dedbf42ca3
|
data/.gitignore
CHANGED
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
|
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
|
-
|
13
|
-
|
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
|
-
|
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.
|
23
|
-
sigdump (~> 0.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 (
|
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.
|
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.
|
44
|
+
serverengine (2.3.2)
|
39
45
|
sigdump (~> 0.2.2)
|
40
|
-
sigdump (0.2.
|
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.
|
56
|
+
tzinfo (2.0.6)
|
51
57
|
concurrent-ruby (~> 1.0)
|
52
|
-
tzinfo-data (1.
|
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.
|
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.
|
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
|
-
|
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
|