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

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
  SHA256:
3
- metadata.gz: 3cd2b97fbf5538d79f925edfa2231254929ad80295ef137ddd1f6f18dc38ebd7
4
- data.tar.gz: 708b7e494707863e469776e94c942f81d556c2b6ccdb84c7d5d24ee244ce8eb6
3
+ metadata.gz: d1239c5bbd380b85554b58cccdaf872b54e893f2b13bf310fddb4e381c35df27
4
+ data.tar.gz: aa9b3bd1297a9ca116cb1737f6e30c7326f280b86429030887df4178f3667059
5
5
  SHA512:
6
- metadata.gz: a2b97e8aad0a0414ea98e9c31d2e59fa767333f3b15133fcbf702304e80bef1982745ddea8f7a191ab7f32fc29c437f8da679c1188f1285c95b533e4b12cfbd7
7
- data.tar.gz: fb54c28711b00c1bdf00ef0e38f7c4609e4f7091ae87d8243e11bdf326b59de4d3aca0c6acab5384539e15c7fa4a17ae6cbdab78863d7c2d0143a6dedbf42ca3
6
+ metadata.gz: 144f5e4c1c3763127d25b48945858a2af3dcef7acb3122ab56203502134bd77300319a03ab9ffc1188d846522b8c3ea454502a228e485f65b12d76ba014afab9
7
+ data.tar.gz: 2e3b936a295ee9fa013bc15d8d1fddf67ed4aaa50de95c77a4668501f30c9d66887978b66b699d28537e9825a000a24e9c96a8ff362d38f17fdb99801d4bb146
@@ -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.29'
22
+ s.version = '2.1.31'
23
23
  s.authors = ['thomas morgan']
24
24
  s.email = ['tm@iprog.com']
25
25
  s.summary = %q{Fluent Syslog TLS output plugin}
@@ -0,0 +1,40 @@
1
+ require 'pp'
2
+
3
+ module SyslogTls
4
+ class HostBackoffSpecs
5
+ attr_accessor :retriesToDo, :hostIPport
6
+
7
+ def initialize(retries_to_do, host_ip_port)
8
+ @retriesToDo = retries_to_do
9
+ @hostIPport = host_ip_port
10
+ @failTime = nil
11
+ @baseThreshold = 2
12
+ end
13
+
14
+ def canwrite
15
+ time_passed_since_failure = -1
16
+ if @failTime != nil
17
+ time_passed_since_failure = Time.now - @failTime
18
+ time_passed_since_failure = time_passed_since_failure.round(2)
19
+ end
20
+ if time_passed_since_failure == -1
21
+ return 1
22
+ end
23
+ if time_passed_since_failure > @baseThreshold ** @retriesToDo
24
+ return 1
25
+ else
26
+ return 0
27
+ end
28
+ end
29
+
30
+ def failtowrite
31
+ @retriesToDo += 1
32
+ @failTime = Time.now
33
+ end
34
+
35
+ def resetRetries
36
+ @retriesToDo = 0
37
+ @failTime = nil
38
+ end
39
+ end
40
+ end
@@ -31,6 +31,7 @@ module SyslogTls
31
31
  attr_writer :retries
32
32
 
33
33
  def initialize(host, port, idle_timeout: nil, ca_cert: 'system', client_cert: nil, client_key: nil, verify_cert_name: true, ssl_version: :TLS1_2, max_retries: 1)
34
+ pp "initialize SSLTransport"
34
35
  @host = host
35
36
  @port = port
36
37
  @idle_timeout = idle_timeout
@@ -44,18 +45,24 @@ module SyslogTls
44
45
  end
45
46
 
46
47
  def connect
48
+ timwnow = Time.now
49
+ pp "initialize SSLTransport.connect"+ timwnow.to_s
47
50
  @socket = get_ssl_connection
48
51
  begin
49
52
  begin
50
53
  @socket.connect_nonblock
51
54
  rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
55
+ pp "initialize SSLTransport Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable"
52
56
  select_with_timeout(@socket, :connect_read) && retry
53
57
  rescue IO::WaitWritable
58
+ pp "initialize SSLTransport IO::WaitWritable"
54
59
  select_with_timeout(@socket, :connect_write) && retry
55
60
  end
56
61
  rescue Errno::ETIMEDOUT
62
+ pp "initialize SSLTransport Errno::ETIMEDOUT"
57
63
  raise 'Socket timeout during connect'
58
64
  end
65
+ pp "initialize SSLTransport last_write"
59
66
  @last_write = Time.now if idle_timeout
60
67
  end
61
68
 
@@ -125,7 +132,9 @@ module SyslogTls
125
132
 
126
133
  # Allow to retry on failed writes
127
134
  def write(s)
135
+ pp "initialize SSLTransport.write"
128
136
  if idle_timeout
137
+ pp "initialize SSLTransport.write idle_timeout" + idle_timeout.to_s
129
138
  if (t=Time.now) > @last_write + idle_timeout
130
139
  @socket.close rescue nil
131
140
  connect
@@ -134,6 +143,7 @@ module SyslogTls
134
143
  end
135
144
  end
136
145
  begin
146
+ pp "initialize SSLTransport.write !idle_timeout"
137
147
  retry_id ||= 0
138
148
  do_write(s)
139
149
  rescue => e
@@ -167,7 +177,9 @@ module SyslogTls
167
177
  end
168
178
 
169
179
  def select_with_timeout(tcp, type)
180
+
170
181
  host_ip_port = host + ":" + port.to_s
182
+ pp "initialize SSLTransport.select_with_timeout :: " + host_ip_port
171
183
 
172
184
  case type
173
185
  when :connect_read
@@ -186,9 +198,11 @@ module SyslogTls
186
198
  reset_tries(host_ip_port)
187
199
  else
188
200
  increase_retry(host_ip_port)
201
+ pp "initialize SSLTransport.select_with_timeout :: Socket timeout"
189
202
  raise("Socket timeout during #{type}")
190
203
  end
191
204
  else
205
+ pp "initialize SSLTransport.select_with_timeout :: Failed to write"
192
206
  raise("Failed to write #{type}")
193
207
  end
194
208
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.29
4
+ version: 2.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-08 00:00:00.000000000 Z
11
+ date: 2024-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -134,6 +134,7 @@ files:
134
134
  - fluent-plugin-syslog-tls.gemspec
135
135
  - lib/fluent/plugin/out_syslog_tls.rb
136
136
  - lib/syslog_tls/facility.rb
137
+ - lib/syslog_tls/host_backoff_specs.rb
137
138
  - lib/syslog_tls/logger.rb
138
139
  - lib/syslog_tls/lookup_from_const.rb
139
140
  - lib/syslog_tls/protocol.rb