fluent-plugin-sumologic-cloud-syslog 0.1.5 → 0.1.7

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
  SHA1:
3
- metadata.gz: cc1578a36f862ac01507d453ca8350c60372efd6
4
- data.tar.gz: 5b70bff66226ac8825fbd755905933a3cfca92ff
3
+ metadata.gz: 9fbd5d2765b6436b661f0ba85d2643d241860b78
4
+ data.tar.gz: 19331eadf81f8686a4c74390d1beb29a5d8c0cf6
5
5
  SHA512:
6
- metadata.gz: 2bf21eb35786fcf3c0ee842afdcc5f62ae8ac668f530f7e44a9c633cb4d6a27af7ead09473cf3ae647a6545a2bfd0b4c327e33b56418fe4d1e9bab54027c5b2f
7
- data.tar.gz: 61f2320b80887d030696e36f7931519550a32777bfb6414a8f5bb94322f816f26e7055ebe8db63aef81b24ec2f7db1aa99c15c5a66fb64e27fe37231f21f3025
6
+ metadata.gz: b4c2423730252990ac8e09d24c14bf00858933b778d61680895ea646f131557718ad43f892ef5a5ab0888f3f9ba16a4170cf0ec4ab4c0f89af7f84476c86887f
7
+ data.tar.gz: f31e290ca1de21be6bdf6686273256da3ab1dbfd318d7086715ce21719da6c19a8809886f60dd81abf12257f28bc7101223f15eff5bef79965d1331d45f8e4dc
@@ -105,13 +105,17 @@ module Fluent
105
105
  'INFO'
106
106
  end
107
107
 
108
- # Send message to Sumo
109
- logger(tag).log(severity, format(tag, time, record), time: Time.at(time)) { |header|
110
- # Map syslog headers from record
111
- @mappings.each do |name, record_key|
112
- header.send("#{name}=", record[record_key]) unless record[record_key].nil?
108
+ # Send message to Sumologic
109
+ begin
110
+ logger(tag).log(severity, format(tag, time, record), time: Time.at(time)) do |header|
111
+ # Map syslog headers from record
112
+ @mappings.each do |name, record_key|
113
+ header.send("#{name}=", record[record_key]) unless record[record_key].nil?
114
+ end
113
115
  end
114
- }
116
+ rescue => e
117
+ log.error e.to_s
118
+ end
115
119
  end
116
120
  end
117
121
  end
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module SumologicCloudSyslog
16
- VERSION = '0.1.5'
16
+ VERSION = '0.1.7'
17
17
  end
@@ -18,7 +18,9 @@ require 'date'
18
18
  require 'minitest/mock'
19
19
  require 'fluent/plugin/out_sumologic_cloud_syslog'
20
20
 
21
- class SumologicCloudSyslogOutput < SSLTest
21
+ class SumologicCloudSyslogOutput < Test::Unit::TestCase
22
+ include SSLTestHelper
23
+
22
24
  def setup
23
25
  Fluent::Test.setup
24
26
  @driver = nil
data/test/ssl.rb CHANGED
@@ -1,53 +1,51 @@
1
1
  require 'socket'
2
2
  require 'openssl'
3
3
 
4
- class SSLTest < Test::Unit::TestCase
5
- def ssl_server
6
- @ssl_server ||= begin
7
- tcp_server = TCPServer.new("localhost", 33000 + Random.rand(1000))
8
- ssl_context = OpenSSL::SSL::SSLContext.new
9
- ssl_context.cert = certificate
10
- ssl_context.key = rsa_key
11
- OpenSSL::SSL::SSLServer.new(tcp_server, ssl_context)
12
- end
4
+ module SSLTestHelper
5
+ def ssl_server
6
+ @ssl_server ||= begin
7
+ tcp_server = TCPServer.new("localhost", 33000 + Random.rand(1000))
8
+ ssl_context = OpenSSL::SSL::SSLContext.new
9
+ ssl_context.cert = certificate
10
+ ssl_context.key = rsa_key
11
+ OpenSSL::SSL::SSLServer.new(tcp_server, ssl_context)
13
12
  end
13
+ end
14
14
 
15
- def ssl_client
16
- tcp = TCPSocket.new("localhost", ssl_server.addr[1])
17
- ctx = OpenSSL::SSL::SSLContext.new
18
- ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
19
- ctx.cert = certificate
20
- ctx.key = rsa_key
21
- OpenSSL::SSL::SSLSocket.new(tcp, ctx)
22
- end
23
-
24
- def rsa_key
25
- @rsa_key ||= OpenSSL::PKey::RSA.new(2048)
26
- end
15
+ def ssl_client
16
+ tcp = TCPSocket.new("localhost", ssl_server.addr[1])
17
+ ctx = OpenSSL::SSL::SSLContext.new
18
+ ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
19
+ ctx.cert = certificate
20
+ ctx.key = rsa_key
21
+ OpenSSL::SSL::SSLSocket.new(tcp, ctx)
22
+ end
27
23
 
28
- def certificate
29
- @cert ||= begin
30
- subject = "/C=BE/O=Test/OU=Test/CN=Test"
24
+ def rsa_key
25
+ @rsa_key ||= OpenSSL::PKey::RSA.new(2048)
26
+ end
31
27
 
32
- @cert = OpenSSL::X509::Certificate.new
33
- @cert.subject = @cert.issuer = OpenSSL::X509::Name.parse(subject)
34
- @cert.not_before = Time.now
35
- @cert.not_after = Time.now + 365 * 24 * 60 * 60
36
- @cert.public_key = rsa_key.public_key
37
- @cert.serial = 0x0
38
- @cert.version = 2
28
+ def certificate
29
+ @cert ||= begin
30
+ cert = OpenSSL::X509::Certificate.new
31
+ cert.subject = cert.issuer = OpenSSL::X509::Name.parse("/C=BE/O=Test/OU=Test/CN=Test")
32
+ cert.not_before = Time.now
33
+ cert.not_after = Time.now + 365 * 24 * 60 * 60
34
+ cert.public_key = rsa_key.public_key
35
+ cert.serial = 0x0
36
+ cert.version = 2
39
37
 
40
- ef = OpenSSL::X509::ExtensionFactory.new
41
- ef.subject_certificate = @cert
42
- ef.issuer_certificate = @cert
43
- @cert.extensions = [
44
- ef.create_extension("basicConstraints","CA:TRUE", true),
45
- ef.create_extension("subjectKeyIdentifier", "hash"),
46
- # ef.create_extension("keyUsage", "cRLSign,keyCertSign", true),
47
- ]
48
- @cert.add_extension ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always")
49
- @cert.sign(rsa_key, OpenSSL::Digest::SHA1.new)
50
- @cert
51
- end
38
+ ef = OpenSSL::X509::ExtensionFactory.new
39
+ ef.subject_certificate = cert
40
+ ef.issuer_certificate = cert
41
+ cert.extensions = [
42
+ ef.create_extension("basicConstraints","CA:TRUE", true),
43
+ ef.create_extension("subjectKeyIdentifier", "hash"),
44
+ # ef.create_extension("keyUsage", "cRLSign,keyCertSign", true),
45
+ ]
46
+ cert.add_extension ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always")
47
+ cert.sign(rsa_key, OpenSSL::Digest::SHA1.new)
48
+ cert
52
49
  end
50
+ end
53
51
  end
@@ -16,7 +16,9 @@ require 'helper'
16
16
  require 'ssl'
17
17
  require 'sumologic_cloud_syslog/ssl_transport'
18
18
 
19
- class SSLTransport < SSLTest
19
+ class SSLTransport < Test::Unit::TestCase
20
+ include SSLTestHelper
21
+
20
22
  def test_ok_connection
21
23
  server = ssl_server
22
24
  st = Thread.new {
@@ -34,7 +36,6 @@ class SSLTransport < SSLTest
34
36
 
35
37
  def test_retry
36
38
  client = Object.new
37
- client.class.module_eval { attr_accessor :retries }
38
39
  def client.connect
39
40
  true
40
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sumologic-cloud-syslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Acquia Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd