fluent-plugin-syslog-gobi-tls 2.1.34 → 2.1.36
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/fluent-plugin-syslog-tls.gemspec +1 -1
 - data/lib/fluent/plugin/out_syslog_tls.rb +18 -2
 - data/lib/syslog_tls/host_backoff_specs.rb +6 -1
 - data/lib/syslog_tls/ssl_transport.rb +13 -26
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4f1260ee80a0b5a4e6a50278b3f882c3110a8a668504636c8c42b8305dfbf79d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 84c64d91c00a2e5e8cb45bb0ccee71dc9a52cca335fa5e323fa5251c25849d3d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9345dd2aef77181aedb9592bb902c70254af0ccca25f03f20dde25f7ae34423a2120bfad9a21e7ed921a16f0ae4a68d013829bc30f944db0861d1509889b585f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c29439b149b58fc2645f2abb6a42eb64f4875a4ee09ce7c99dd34b2b7bbc619d8c3f7b9847ad56586ef82f5d2edd03ccbfd24303edaeb91ae6d413a59d69dbe0
         
     | 
| 
         @@ -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.36'
         
     | 
| 
       23 
23 
     | 
    
         
             
              s.authors       = ['thomas morgan']
         
     | 
| 
       24 
24 
     | 
    
         
             
              s.email         = ['tm@iprog.com']
         
     | 
| 
       25 
25 
     | 
    
         
             
              s.summary       = %q{Fluent Syslog TLS output plugin}
         
     | 
| 
         @@ -30,6 +30,9 @@ def add_host_backoff_spec(retries_to_do, host_ip_port) 
     | 
|
| 
       30 
30 
     | 
    
         
             
            end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
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
         
     | 
| 
       33 
36 
     | 
    
         
             
              begin
         
     | 
| 
       34 
37 
     | 
    
         
             
                $host_backoff_specs_list.each do |backoff_specs|
         
     | 
| 
       35 
38 
     | 
    
         
             
                  if backoff_specs.hostIPport == host_ip_port
         
     | 
| 
         @@ -44,10 +47,11 @@ def can_write(host_ip_port) 
     | 
|
| 
       44 
47 
     | 
    
         
             
            end
         
     | 
| 
       45 
48 
     | 
    
         | 
| 
       46 
49 
     | 
    
         
             
            def increase_retry(host_ip_port)
         
     | 
| 
       47 
     | 
    
         
            -
               
     | 
| 
      
 50 
     | 
    
         
            +
              if !conatins_host(host_ip_port)
         
     | 
| 
      
 51 
     | 
    
         
            +
                add_host_backoff_spec(0, host_ip_port)
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
       48 
53 
     | 
    
         
             
              begin
         
     | 
| 
       49 
54 
     | 
    
         
             
                $host_backoff_specs_list.each do |backoff_specs|
         
     | 
| 
       50 
     | 
    
         
            -
                  pp "1 :: increase_retry :: backoff_specs.hostIPport " + backoff_specs.hostIPport + " time :: " + Time.now.to_s
         
     | 
| 
       51 
55 
     | 
    
         
             
                  if backoff_specs.hostIPport == host_ip_port
         
     | 
| 
       52 
56 
     | 
    
         
             
                    backoff_specs.failtowrite
         
     | 
| 
       53 
57 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -58,6 +62,9 @@ def increase_retry(host_ip_port) 
     | 
|
| 
       58 
62 
     | 
    
         
             
            end
         
     | 
| 
       59 
63 
     | 
    
         | 
| 
       60 
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
         
     | 
| 
       61 
68 
     | 
    
         
             
              $host_backoff_specs_list.each do |backoff_specs|
         
     | 
| 
       62 
69 
     | 
    
         
             
                if backoff_specs.hostIPport == host_ip_port
         
     | 
| 
       63 
70 
     | 
    
         
             
                  backoff_specs.resetRetries
         
     | 
| 
         @@ -65,6 +72,15 @@ def reset_tries(host_ip_port) 
     | 
|
| 
       65 
72 
     | 
    
         
             
              end
         
     | 
| 
       66 
73 
     | 
    
         
             
            end
         
     | 
| 
       67 
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 
     | 
    
         
            +
             
     | 
| 
       68 
84 
     | 
    
         
             
            module Fluent::Plugin
         
     | 
| 
       69 
85 
     | 
    
         
             
              class SyslogTlsOutput < Output
         
     | 
| 
       70 
86 
     | 
    
         
             
                Fluent::Plugin.register_output('syslog_tls', self)
         
     | 
| 
         @@ -20,7 +20,12 @@ module SyslogTls 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  if time_passed_since_failure == -1
         
     | 
| 
       21 
21 
     | 
    
         
             
                    return 1
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
     | 
    
         
            -
                   
     | 
| 
      
 23 
     | 
    
         
            +
                  backoffTime = @baseThreshold ** @retriesToDo
         
     | 
| 
      
 24 
     | 
    
         
            +
                  if backoffTime > 3600
         
     | 
| 
      
 25 
     | 
    
         
            +
                    backoffTime = 3600
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  if time_passed_since_failure > backoffTime
         
     | 
| 
      
 28 
     | 
    
         
            +
                    pp "canwrite writting after backoff :: time_passed_since_failure" + time_passed_since_failure.to_s + " time :: " + Time.now.to_s
         
     | 
| 
       24 
29 
     | 
    
         
             
                    return 1
         
     | 
| 
       25 
30 
     | 
    
         
             
                  else
         
     | 
| 
       26 
31 
     | 
    
         
             
                    return 0
         
     | 
| 
         @@ -31,7 +31,6 @@ 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"
         
     | 
| 
       35 
34 
     | 
    
         
             
                  @host = host
         
     | 
| 
       36 
35 
     | 
    
         
             
                  @port = port
         
     | 
| 
       37 
36 
     | 
    
         
             
                  @idle_timeout = idle_timeout
         
     | 
| 
         @@ -46,23 +45,18 @@ module SyslogTls 
     | 
|
| 
       46 
45 
     | 
    
         | 
| 
       47 
46 
     | 
    
         
             
                def connect
         
     | 
| 
       48 
47 
     | 
    
         
             
                  timwnow = Time.now
         
     | 
| 
       49 
     | 
    
         
            -
                  pp "initialize SSLTransport.connect"+ timwnow.to_s
         
     | 
| 
       50 
48 
     | 
    
         
             
                  @socket = get_ssl_connection
         
     | 
| 
       51 
49 
     | 
    
         
             
                  begin
         
     | 
| 
       52 
50 
     | 
    
         
             
                    begin
         
     | 
| 
       53 
51 
     | 
    
         
             
                      @socket.connect_nonblock
         
     | 
| 
       54 
52 
     | 
    
         
             
                    rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
         
     | 
| 
       55 
     | 
    
         
            -
                      pp "initialize SSLTransport Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable"
         
     | 
| 
       56 
53 
     | 
    
         
             
                      select_with_timeout(@socket, :connect_read) && retry
         
     | 
| 
       57 
54 
     | 
    
         
             
                    rescue IO::WaitWritable
         
     | 
| 
       58 
     | 
    
         
            -
                      pp "initialize SSLTransport IO::WaitWritable"
         
     | 
| 
       59 
55 
     | 
    
         
             
                      select_with_timeout(@socket, :connect_write) && retry
         
     | 
| 
       60 
56 
     | 
    
         
             
                    end
         
     | 
| 
       61 
57 
     | 
    
         
             
                  rescue Errno::ETIMEDOUT
         
     | 
| 
       62 
     | 
    
         
            -
                    pp "initialize SSLTransport Errno::ETIMEDOUT"
         
     | 
| 
       63 
58 
     | 
    
         
             
                    raise 'Socket timeout during connect'
         
     | 
| 
       64 
59 
     | 
    
         
             
                  end
         
     | 
| 
       65 
     | 
    
         
            -
                  pp "initialize SSLTransport last_write"
         
     | 
| 
       66 
60 
     | 
    
         
             
                  @last_write = Time.now if idle_timeout
         
     | 
| 
       67 
61 
     | 
    
         
             
                end
         
     | 
| 
       68 
62 
     | 
    
         | 
| 
         @@ -132,9 +126,7 @@ module SyslogTls 
     | 
|
| 
       132 
126 
     | 
    
         | 
| 
       133 
127 
     | 
    
         
             
                # Allow to retry on failed writes
         
     | 
| 
       134 
128 
     | 
    
         
             
                def write(s)
         
     | 
| 
       135 
     | 
    
         
            -
                  pp "initialize SSLTransport.write"
         
     | 
| 
       136 
129 
     | 
    
         
             
                  if idle_timeout
         
     | 
| 
       137 
     | 
    
         
            -
                    pp "initialize SSLTransport.write idle_timeout" + idle_timeout.to_s
         
     | 
| 
       138 
130 
     | 
    
         
             
                    if (t=Time.now) > @last_write + idle_timeout
         
     | 
| 
       139 
131 
     | 
    
         
             
                      @socket.close rescue nil
         
     | 
| 
       140 
132 
     | 
    
         
             
                      connect
         
     | 
| 
         @@ -143,7 +135,6 @@ module SyslogTls 
     | 
|
| 
       143 
135 
     | 
    
         
             
                    end
         
     | 
| 
       144 
136 
     | 
    
         
             
                  end
         
     | 
| 
       145 
137 
     | 
    
         
             
                  begin
         
     | 
| 
       146 
     | 
    
         
            -
                    pp "initialize SSLTransport.write !idle_timeout"
         
     | 
| 
       147 
138 
     | 
    
         
             
                    retry_id ||= 0
         
     | 
| 
       148 
139 
     | 
    
         
             
                    do_write(s)
         
     | 
| 
       149 
140 
     | 
    
         
             
                  rescue => e
         
     | 
| 
         @@ -177,10 +168,7 @@ module SyslogTls 
     | 
|
| 
       177 
168 
     | 
    
         
             
                end
         
     | 
| 
       178 
169 
     | 
    
         | 
| 
       179 
170 
     | 
    
         
             
                def select_with_timeout(tcp, type)
         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
171 
     | 
    
         
             
                  host_ip_port = host + ":" + port.to_s
         
     | 
| 
       182 
     | 
    
         
            -
                  pp "1: initialize SSLTransport.select_with_timeout :: " + host_ip_port + " time :: " + Time.now.to_s
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
172 
     | 
    
         
             
                  case type
         
     | 
| 
       185 
173 
     | 
    
         
             
                  when :connect_read
         
     | 
| 
       186 
174 
     | 
    
         
             
                    args = [[tcp], nil, nil, CONNECT_TIMEOUT]
         
     | 
| 
         @@ -193,24 +181,23 @@ module SyslogTls 
     | 
|
| 
       193 
181 
     | 
    
         
             
                  else
         
     | 
| 
       194 
182 
     | 
    
         
             
                    raise "Unknown select type #{type}"
         
     | 
| 
       195 
183 
     | 
    
         
             
                  end
         
     | 
| 
       196 
     | 
    
         
            -
                   
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
                       
     | 
| 
      
 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
         
     | 
| 
       204 
195 
     | 
    
         
             
                    else
         
     | 
| 
       205 
     | 
    
         
            -
                       
     | 
| 
       206 
     | 
    
         
            -
                      pp "initialize SSLTransport.select_with_timeout :: Socket timeout" + " time :: " + Time.now.to_s
         
     | 
| 
       207 
     | 
    
         
            -
                      raise("Socket timeout during #{type}")
         
     | 
| 
      
 196 
     | 
    
         
            +
                      io_select_return || raise("Failed to write #{type}")
         
     | 
| 
       208 
197 
     | 
    
         
             
                    end
         
     | 
| 
       209 
198 
     | 
    
         
             
                  else
         
     | 
| 
       210 
     | 
    
         
            -
                     
     | 
| 
       211 
     | 
    
         
            -
                    raise("Failed to write #{type}")
         
     | 
| 
      
 199 
     | 
    
         
            +
                    IO.select(*args) || raise("Socket timeout during #{type}")
         
     | 
| 
       212 
200 
     | 
    
         
             
                  end
         
     | 
| 
       213 
     | 
    
         
            -
                  ready_sockets || raise("Socket timeout during #{type}")
         
     | 
| 
       214 
201 
     | 
    
         
             
                end
         
     | 
| 
       215 
202 
     | 
    
         | 
| 
       216 
203 
     | 
    
         
             
                # Forward any methods directly to SSLSocket
         
     | 
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.36
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-05-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: fluentd
         
     |