logstash-output-newrelic 1.5.1 → 1.5.3.pre.beta

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: b9339803f78539fb9240937234cc69240b289f8050c9ddfd37210f423570d828
4
- data.tar.gz: 14746a11f4c482bebe359504f9a66987bb6d500fb6e4b38f2d839a508aa4d62b
3
+ metadata.gz: 6e6602cfaf1e84ab5266bc57ee5f1204e6c0d97bd105aef863716948ccf00e9c
4
+ data.tar.gz: 60881efb2528e47145e8463ac900ac1a2242439da372e2e158145a98311276db
5
5
  SHA512:
6
- metadata.gz: 7cf438c882e3017df2597038d8812110d2fd8037c57c3d5e0440e1f11396143fa4aa52b1ad639d617cc32fb0c7ed05ac148bf70088d1e9dfab8b4170bf136f43
7
- data.tar.gz: b6c5a7c7acf89da4da50a1e675a9339ccc8f17cd5bce2b4e0662f7be1ee4211ecce1ad0b120036084938bdf388aee3224ab6fdf5b83625856cc0a8caa8dbc38a
6
+ metadata.gz: 4067206a4067349f7bad7bebaaae4893348d1a1adaef54a4de6dec23c97ac6e19bd5adea20c1111413e70bf04e536925ca61086caa759a3a67321733b7944f48
7
+ data.tar.gz: eb4f19eec0a8bcdfb62e37799487fb5968230f4030cf4f72e6d26d38dda13570d39f1e28004243002c461d692a5ab664d21d59b44bb7c31701a315b73e5d2151
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/outputs/base"
3
3
  require "logstash/outputs/newrelic_version/version"
4
+ require 'resolv-replace'
4
5
  require 'net/http'
5
6
  require 'uri'
6
7
  require 'zlib'
@@ -163,10 +164,10 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
163
164
  retry_duration = 1
164
165
 
165
166
  begin
166
- http = Net::HTTP.new(@end_point.host, 443)
167
+ http = Net::HTTP.new(@end_point.host, @end_point.port || 443)
167
168
  request = Net::HTTP::Post.new(@end_point.request_uri)
168
- http.use_ssl = true
169
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
169
+ http.use_ssl = (@end_point.scheme == 'https')
170
+ http.verify_mode = @end_point.scheme == 'https' ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
170
171
  if !@custom_ca_cert.nil?
171
172
  store = OpenSSL::X509::Store.new
172
173
  ca_cert = OpenSSL::X509::Certificate.new(File.read(@custom_ca_cert))
@@ -1,7 +1,7 @@
1
1
  module LogStash
2
2
  module Outputs
3
3
  module NewRelicVersion
4
- VERSION = "1.5.1"
4
+ VERSION = "1.5.3-beta"
5
5
  end
6
6
  end
7
7
  end
@@ -7,6 +7,7 @@ require "logstash/event"
7
7
  require "thread"
8
8
  require "webmock/rspec"
9
9
  require "zlib"
10
+ require "rspec/wait"
10
11
 
11
12
  describe LogStash::Outputs::NewRelic do
12
13
  let (:base_uri) { "https://testing-example-collector.com" }
@@ -48,6 +49,50 @@ describe LogStash::Outputs::NewRelic do
48
49
  })).to have_been_made
49
50
  end
50
51
  end
52
+
53
+ context "check https connection scheme" do
54
+ it "uses https by default" do
55
+ stub_request(:any, base_uri).to_return(status: 200)
56
+
57
+ event = LogStash::Event.new({:message => "Test message" })
58
+ @newrelic_output.multi_receive([event])
59
+
60
+ wait_for(a_request(:post, base_uri)
61
+ .with(headers: {
62
+ "X-License-Key" => license_key,
63
+ "X-Event-Source" => "logs",
64
+ "Content-Encoding" => "gzip",
65
+ })).to have_been_made
66
+
67
+ # Check if the requests were made using HTTPS
68
+ expect(WebMock).to have_requested(:post, base_uri).with { |req| req.uri.scheme == 'https' }
69
+ expect(WebMock).to have_requested(:post, base_uri).with { |req| req.uri.port == 443 }
70
+ end
71
+ end
72
+
73
+ context "check http connection scheme" do
74
+ it "uses http when http config is set" do
75
+ stub_request(:any, "http://localhost:5000/").to_return(status: 200)
76
+ @newrelic_output = LogStash::Plugin.lookup("output", "newrelic").new({
77
+ "base_uri" => "http://localhost:5000/",
78
+ "license_key" => license_key
79
+ })
80
+ @newrelic_output.register
81
+ event = LogStash::Event.new({:message => "Test message" })
82
+ @newrelic_output.multi_receive([event])
83
+
84
+ wait_for(a_request(:post, "http://localhost:5000/")
85
+ .with(headers: {
86
+ "X-License-Key" => license_key,
87
+ "X-Event-Source" => "logs",
88
+ "Content-Encoding" => "gzip",
89
+ })).to have_been_made
90
+
91
+ # Check if the requests were made using HTTP to this endpoint
92
+ expect(WebMock).to have_requested(:post, "http://localhost:5000/").with { |req| req.uri.scheme == 'http' }
93
+ expect(WebMock).to have_requested(:post, "http://localhost:5000/").with { |req| req.uri.port == 5000 }
94
+ end
95
+ end
51
96
  end
52
97
 
53
98
  describe LogStash::Outputs::NewRelic do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-newrelic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.3.pre.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - New Relic Logging Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2025-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -146,9 +146,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - ">"
150
150
  - !ruby/object:Gem::Version
151
- version: '0'
151
+ version: 1.3.1
152
152
  requirements: []
153
153
  rubygems_version: 3.0.6
154
154
  signing_key: