fluent-plugin-syslog-tls-with-backoff-test 2.1.3 → 2.1.5

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: d34903d857280d89528357934635c1c1d1203e6f65dc20d25389af2c88d8ef58
4
- data.tar.gz: 20ddeb9c2ffc7054aabe930e48e87f2df502c544bedcfa410b2e16e5319025e8
3
+ metadata.gz: f63360e8ba81c074c2a2e97ba6fc1992c1266a3f343be95e906ca0720c0e50ef
4
+ data.tar.gz: 50cd80391373d67d4df98686a15d182eb2706eef8987894356748414f65b6f70
5
5
  SHA512:
6
- metadata.gz: ce81c8d18b68c8a60816003ca738298e91adcf24efaf3bfd9d545d758bc1f4c8a5fb016acd5beef5d6ae8d67799233fcbbc9a4f909db97a0494756b0a07708c1
7
- data.tar.gz: 811c0678241b37ea72d10c397fff5a632334982c44af7121614b40ba48fcd4e434218942f54340dbb9b2b13887a752230bbccf8ed87d19aa78b08da102b1e680
6
+ metadata.gz: 8bef8e2ced5f69828b8df0e54298e1405c8353d86716277450effb68c52b5e86d8ec2da4a9681a877b196ce15daeffe9fb3cbcfbb747baf807bd5ba975bea4c9
7
+ data.tar.gz: 2b75cfea01bd9e1d5e85b609e49de3445d52f27e87977a85602c491179afbe2fea877c4959a124bdf1e14012ba8ebd8599f06f8750ec85754568abc9640e8a71
data/.gitignore CHANGED
@@ -37,4 +37,3 @@ 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-with-backoff (2.1.0)
4
+ fluent-plugin-syslog-tls (2.1.0.rc1)
5
5
  fluentd (>= 0.14.0, < 2)
6
6
 
7
7
  GEM
@@ -9,41 +9,35 @@ GEM
9
9
  specs:
10
10
  addressable (2.8.1)
11
11
  public_suffix (>= 2.0.2, < 6.0)
12
- base64 (0.2.0)
13
- concurrent-ruby (1.2.3)
14
- cool.io (1.8.0)
12
+ concurrent-ruby (1.1.10)
13
+ cool.io (1.7.1)
15
14
  crack (0.4.5)
16
15
  rexml
17
- csv (3.3.0)
18
16
  docile (1.4.0)
19
- drb (2.2.1)
20
- fluentd (1.17.0)
21
- base64 (~> 0.2)
17
+ fluentd (1.15.3)
22
18
  bundler
23
19
  cool.io (>= 1.4.5, < 2.0.0)
24
- csv (~> 3.2)
25
- drb (~> 2.2)
26
20
  http_parser.rb (>= 0.5.1, < 0.9.0)
27
21
  msgpack (>= 1.3.1, < 2.0.0)
28
- serverengine (>= 2.3.2, < 3.0.0)
29
- sigdump (~> 0.2.5)
22
+ serverengine (>= 2.3.0, < 3.0.0)
23
+ sigdump (~> 0.2.2)
30
24
  strptime (>= 0.2.4, < 1.0.0)
31
25
  tzinfo (>= 1.0, < 3.0)
32
26
  tzinfo-data (~> 1.0)
33
- webrick (~> 1.4)
27
+ webrick (>= 1.4.2, < 1.8.0)
34
28
  yajl-ruby (~> 1.0)
35
29
  hashdiff (1.0.1)
36
30
  http_parser.rb (0.8.0)
37
31
  minitest (5.17.0)
38
32
  minitest-stub_any_instance (1.0.3)
39
- msgpack (1.7.2)
33
+ msgpack (1.6.0)
40
34
  power_assert (2.0.3)
41
35
  public_suffix (5.0.1)
42
36
  rake (13.0.6)
43
37
  rexml (3.2.5)
44
- serverengine (2.3.2)
38
+ serverengine (2.3.1)
45
39
  sigdump (~> 0.2.2)
46
- sigdump (0.2.5)
40
+ sigdump (0.2.4)
47
41
  simplecov (0.22.0)
48
42
  docile (~> 1.1)
49
43
  simplecov-html (~> 0.11)
@@ -53,22 +47,22 @@ GEM
53
47
  strptime (0.2.5)
54
48
  test-unit (3.5.7)
55
49
  power_assert
56
- tzinfo (2.0.6)
50
+ tzinfo (2.0.5)
57
51
  concurrent-ruby (~> 1.0)
58
- tzinfo-data (1.2024.1)
52
+ tzinfo-data (1.2022.7)
59
53
  tzinfo (>= 1.0.0)
60
54
  webmock (3.18.1)
61
55
  addressable (>= 2.8.0)
62
56
  crack (>= 0.3.2)
63
57
  hashdiff (>= 0.4.0, < 2.0.0)
64
- webrick (1.8.1)
58
+ webrick (1.7.0)
65
59
  yajl-ruby (1.4.3)
66
60
 
67
61
  PLATFORMS
68
62
  ruby
69
63
 
70
64
  DEPENDENCIES
71
- fluent-plugin-syslog-tls-with-backoff!
65
+ fluent-plugin-syslog-tls!
72
66
  minitest (~> 5.8)
73
67
  minitest-stub_any_instance (~> 1.0.0)
74
68
  rake
@@ -20,11 +20,11 @@ require 'syslog_tls/version'
20
20
  Gem::Specification.new do |s|
21
21
  s.name = 'fluent-plugin-syslog-tls-with-backoff-test'
22
22
  s.version = SyslogTls::VERSION
23
- s.authors = ['thomas morgan', 'muhammad adil ghaffar']
24
- s.email = ['tm@iprog.com', 'muhammad.sdil.ghaffar@est.tech']
23
+ s.authors = ['thomas morgan']
24
+ s.email = ['tm@iprog.com']
25
25
  s.summary = %q{Fluent Syslog TLS output plugin}
26
- s.description = %q{Syslog TLS output plugin with formatting support, for Fluentd. This is cutom version backoff.}
27
- s.homepage = 'https://github.com/Nordix/fluent-plugin-syslog-tls/tree/add-expo-backoff/adil'
26
+ s.description = %q{Syslog TLS output plugin with formatting support, for Fluentd}
27
+ s.homepage = 'https://github.com/zarqman/fluent-plugin-syslog-tls'
28
28
  s.license = 'Apache v2'
29
29
  s.files = `git ls-files`.split($/)
30
30
  s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -16,70 +16,6 @@
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
- if !conatins_host(host_ip_port)
34
- add_host_backoff_spec(0, host_ip_port)
35
- end
36
- begin
37
- $host_backoff_specs_list.each do |backoff_specs|
38
- if backoff_specs.hostIPport == host_ip_port
39
- return backoff_specs.canwrite
40
- end
41
- end
42
- rescue => e
43
- pp "Error in can_write: #{e.message}"
44
- return 0
45
- end
46
- return 1
47
- end
48
-
49
- def increase_retry(host_ip_port)
50
- if !conatins_host(host_ip_port)
51
- add_host_backoff_spec(0, host_ip_port)
52
- end
53
- begin
54
- $host_backoff_specs_list.each do |backoff_specs|
55
- if backoff_specs.hostIPport == host_ip_port
56
- backoff_specs.failtowrite
57
- end
58
- end
59
- rescue => e
60
- pp "Error in increase_retry: #{e.message}"
61
- end
62
- end
63
-
64
- def reset_tries(host_ip_port)
65
- if !conatins_host(host_ip_port)
66
- add_host_backoff_spec(0, host_ip_port)
67
- end
68
- $host_backoff_specs_list.each do |backoff_specs|
69
- if backoff_specs.hostIPport == host_ip_port
70
- backoff_specs.resetRetries
71
- end
72
- end
73
- end
74
-
75
- def conatins_host(host_ip_port)
76
- $host_backoff_specs_list.each do |backoff_specs|
77
- if backoff_specs.hostIPport == host_ip_port
78
- return true
79
- end
80
- end
81
- return false
82
- end
83
19
 
84
20
  module Fluent::Plugin
85
21
  class SyslogTlsOutput < Output
@@ -146,8 +82,6 @@ module Fluent::Plugin
146
82
  @mappings[key_name] = conf[conf_key] if conf.key?(conf_key)
147
83
  end
148
84
 
149
- add_host_backoff_spec(0, conf['host']+":"+conf['port'])
150
-
151
85
  @formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE)
152
86
  end
153
87
 
@@ -15,7 +15,6 @@
15
15
 
16
16
  require 'socket'
17
17
  require 'openssl'
18
- require 'pp'
19
18
 
20
19
  module SyslogTls
21
20
  # Supports SSL connection to remote host
@@ -44,7 +43,6 @@ module SyslogTls
44
43
  end
45
44
 
46
45
  def connect
47
- timwnow = Time.now
48
46
  @socket = get_ssl_connection
49
47
  begin
50
48
  begin
@@ -168,7 +166,6 @@ module SyslogTls
168
166
  end
169
167
 
170
168
  def select_with_timeout(tcp, type)
171
- host_ip_port = host + ":" + port.to_s
172
169
  case type
173
170
  when :connect_read
174
171
  args = [[tcp], nil, nil, CONNECT_TIMEOUT]
@@ -181,23 +178,7 @@ module SyslogTls
181
178
  else
182
179
  raise "Unknown select type #{type}"
183
180
  end
184
- if type.to_s == "connect_write"
185
- if can_write(host_ip_port) == 1
186
- io_select_return = IO.select(*args)
187
- ready_sockets, _, _ = io_select_return
188
- if !ready_sockets.empty?
189
- reset_tries(host_ip_port)
190
- io_select_return
191
- else
192
- increase_retry(host_ip_port)
193
- io_select_return || raise("Socket timeout during #{type}")
194
- end
195
- # else
196
- # raise("Failed to write #{type}")
197
- end
198
- else
199
- IO.select(*args) || raise("Socket timeout during #{type}")
200
- end
181
+ IO.select(*args) || raise("Socket timeout during #{type}")
201
182
  end
202
183
 
203
184
  # Forward any methods directly to SSLSocket
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module SyslogTls
17
- VERSION = '2.1.3'
17
+ VERSION = '2.1.5'
18
18
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-syslog-tls-with-backoff-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
- - muhammad adil ghaffar
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-05-16 00:00:00.000000000 Z
11
+ date: 2024-05-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: fluentd
@@ -115,11 +114,9 @@ dependencies:
115
114
  - - "~>"
116
115
  - !ruby/object:Gem::Version
117
116
  version: '0.11'
118
- description: Syslog TLS output plugin with formatting support, for Fluentd. This is
119
- cutom version backoff.
117
+ description: Syslog TLS output plugin with formatting support, for Fluentd
120
118
  email:
121
119
  - tm@iprog.com
122
- - muhammad.sdil.ghaffar@est.tech
123
120
  executables: []
124
121
  extensions: []
125
122
  extra_rdoc_files: []
@@ -137,7 +134,6 @@ files:
137
134
  - fluent-plugin-syslog-tls.gemspec
138
135
  - lib/fluent/plugin/out_syslog_tls.rb
139
136
  - lib/syslog_tls/facility.rb
140
- - lib/syslog_tls/host_backoff_specs.rb
141
137
  - lib/syslog_tls/logger.rb
142
138
  - lib/syslog_tls/lookup_from_const.rb
143
139
  - lib/syslog_tls/protocol.rb
@@ -150,7 +146,7 @@ files:
150
146
  - test/syslog_tls/test_logger.rb
151
147
  - test/syslog_tls/test_protocol.rb
152
148
  - test/syslog_tls/test_ssl_transport.rb
153
- homepage: https://github.com/Nordix/fluent-plugin-syslog-tls/tree/add-expo-backoff/adil
149
+ homepage: https://github.com/zarqman/fluent-plugin-syslog-tls
154
150
  licenses:
155
151
  - Apache v2
156
152
  metadata: {}
@@ -1,48 +0,0 @@
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
- pp "time_passed_since_failure is -1"
22
- return 1
23
- end
24
- backoffTime = @baseThreshold ** @retriesToDo
25
- if backoffTime > 1800
26
- backoffTime = 1800
27
- end
28
- if time_passed_since_failure > backoffTime
29
- pp "canwrite writting after backoff :: time_passed_since_failure" + time_passed_since_failure.to_s + " time :: " + Time.now.to_s
30
- return 1
31
- else
32
- return 0
33
- end
34
- end
35
-
36
- def failtowrite
37
- @retriesToDo += 1
38
- @failTime = Time.now
39
- pp "in failtowrite retries :: " + retriesToDo.to_s + " failTime:: " + @failTime.to_s
40
- end
41
-
42
- def resetRetries
43
- @retriesToDo = 0
44
- @failTime = nil
45
- pp "in reset retries"
46
- end
47
- end
48
- end