remote_syslog_sender 1.1.2 → 1.1.3
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/lib/remote_syslog_sender/tcp_sender.rb +41 -18
- data/remote_syslog_sender.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05d03966e485764b3f9a76b96a15d5bd3ed63185
|
4
|
+
data.tar.gz: a0781e58be56ae8206b93e9c60f7fe9bef5654bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4086fc64db33dc77af8eddc63c17822440ef83ef82b14cd2131ca424b9e40c57c86caca741e561aed41defbbef36d8952ab5c6dfdbfcce43888ab44bc5ab92a1
|
7
|
+
data.tar.gz: 15ca1c0a228a16b1480bf5eeb1763487f5f0be02e998a5e454a0e24e9f92893851a501fde875237ef168e47d43a4f2bd0917e5510f6c94954bd16c9dea509d13
|
@@ -35,27 +35,50 @@ module RemoteSyslogSender
|
|
35
35
|
connect
|
36
36
|
end
|
37
37
|
|
38
|
+
def close
|
39
|
+
@socket.close if @socket
|
40
|
+
@tcp_socket.close if @tcp_socket
|
41
|
+
end
|
42
|
+
|
38
43
|
private
|
39
44
|
|
40
45
|
def connect
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
sock.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
@
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
46
|
+
connect_retry_count = 0
|
47
|
+
connect_retry_limit = 2
|
48
|
+
connect_retry_interval = 1
|
49
|
+
begin
|
50
|
+
sock = TCPSocket.new(@remote_hostname, @remote_port)
|
51
|
+
|
52
|
+
if @keep_alive
|
53
|
+
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
|
54
|
+
sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_KEEPIDLE, @keep_alive_idle) if @keep_alive_idle
|
55
|
+
sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_KEEPCNT, @keep_alive_cnt) if @keep_alive_cnt
|
56
|
+
sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_KEEPINTVL, @keep_alive_intvl) if @keep_alive_intvl
|
57
|
+
end
|
58
|
+
if @tls
|
59
|
+
require 'openssl'
|
60
|
+
context = OpenSSL::SSL::SSLContext.new(@ssl_method)
|
61
|
+
context.ca_file = @ca_file if @ca_file
|
62
|
+
context.verify_mode = @verify_mode if @verify_mode
|
63
|
+
|
64
|
+
@tcp_socket = sock
|
65
|
+
@socket = OpenSSL::SSL::SSLSocket.new(sock, context)
|
66
|
+
@socket.connect
|
67
|
+
@socket.post_connection_check(@remote_hostname)
|
68
|
+
raise "test" if connect_retry_count < 1
|
69
|
+
raise "verification error" if @socket.verify_result != OpenSSL::X509::V_OK
|
70
|
+
else
|
71
|
+
@socket = sock
|
72
|
+
end
|
73
|
+
rescue => e
|
74
|
+
close
|
75
|
+
if connect_retry_count < connect_retry_limit
|
76
|
+
sleep connect_retry_interval
|
77
|
+
connect_retry_count += 1
|
78
|
+
retry
|
79
|
+
else
|
80
|
+
raise
|
81
|
+
end
|
59
82
|
end
|
60
83
|
end
|
61
84
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'remote_syslog_sender'
|
3
|
-
s.version = '1.1.
|
3
|
+
s.version = '1.1.3'
|
4
4
|
s.summary = "Message sender that sends directly to a remote syslog endpoint"
|
5
5
|
s.description = "Message sender that sends directly to a remote syslog endpoint (Support UDP, TCP, TCP+TLS)"
|
6
6
|
|