logstash-output-newrelic 1.2.1 → 1.3.0

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
  SHA256:
3
- metadata.gz: a4569ef6cca71b35b48be2b7ad4f42c5648368a082ec71af161c4024d841df53
4
- data.tar.gz: d8e2e7397ddc36ad08710f4dbe67b4cfb6f795ca6fa379502991bc0323673169
3
+ metadata.gz: 7f6e7768d78135be1d77a25e79d4db1eacbe23c5d1a31b4c738073672dfb3aa3
4
+ data.tar.gz: 8844275d5c3e3d5200d3a3461050e5f46053a7614582377db4480aca600b780c
5
5
  SHA512:
6
- metadata.gz: accb5c5d6ee856dc360e0522ac052cffee7e65ab8808e0bc19a588ad247ae7bb0c1132d96e105afc520560ebcdb85033af290a3af1b96cdb838623535f2510bc
7
- data.tar.gz: cec14c1c4e073bba5533cc77a60b9abe4b85d5cde2a6cad8a563140273ac965a02d02e26e778bbab6285027ebd9123f58e7f94b7f5b5fca6d4e240d27432c48e
6
+ metadata.gz: b71c733f87e3e1ec200b1ee101a9d293a84e20f744fcd8aa2b572b93e0523bda83af67d216d94b90da9c273152874ec832f1e1c7c02250fabee0cafc9b53a315
7
+ data.tar.gz: '0617081a05a7a31f9e5f0469836fd55016f8c7fbe971851ad531c646819898a31dc7303d1aa569be3fbec98f173d39bc60c7d090594c074745f0c72d70a42545'
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
2
+
1
3
  # New Relic Logstash Output Plugin
2
4
 
3
5
  This is a plugin for [Logstash](https://github.com/elastic/logstash) that outputs logs to New Relic.
@@ -65,7 +67,7 @@ When using this plugin in the EU override the base_uri with `https://log-api.eu.
65
67
 
66
68
  ## Testing
67
69
 
68
- An easy way to test the plugin is to make sure Logstash is getting input from a log file you
70
+ An easy way to test the plugin is to make sure Logstash is getting input from a log file you
69
71
  can write to. Something like this in your logstash.conf:
70
72
  ```
71
73
  input {
@@ -77,3 +79,18 @@ input {
77
79
  * Restart Logstash
78
80
  * Append a test log message to your log file: `echo "test message" >> /path/to/your/log/file`
79
81
  * Search New Relic Logs for `"test message"`
82
+
83
+ ## Community
84
+
85
+ New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub: [Log forwarding](https://discuss.newrelic.com/tag/log-forwarding)
86
+
87
+ ## A note about vulnerabilities
88
+
89
+ As noted in our [security policy](../../security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
90
+
91
+ If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic).
92
+
93
+ If you would like to contribute to this project, review [these guidelines](https://opensource.newrelic.com/code-of-conduct/).
94
+
95
+ ## License
96
+ logstash-output-plugin is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
@@ -23,6 +23,8 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
23
23
  config :concurrent_requests, :validate => :number, :default => 1
24
24
  config :base_uri, :validate => :string, :default => "https://log-api.newrelic.com/log/v1"
25
25
  config :max_retries, :validate => :number, :default => 3
26
+ # Only used for E2E testing
27
+ config :custom_ca_cert, :validate => :string, :required => false
26
28
 
27
29
  public
28
30
 
@@ -37,7 +39,8 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
37
39
  }
38
40
  @header = {
39
41
  'X-Event-Source' => 'logs',
40
- 'Content-Encoding' => 'gzip'
42
+ 'Content-Encoding' => 'gzip',
43
+ 'Content-Type' => 'application/json'
41
44
  }.merge(auth).freeze
42
45
  @executor = java.util.concurrent.Executors.newFixedThreadPool(@concurrent_requests)
43
46
  @semaphor = java.util.concurrent.Semaphore.new(@concurrent_requests)
@@ -131,6 +134,12 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
131
134
  request = Net::HTTP::Post.new(@end_point.request_uri)
132
135
  http.use_ssl = true
133
136
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
137
+ if !@custom_ca_cert.nil?
138
+ store = OpenSSL::X509::Store.new
139
+ ca_cert = OpenSSL::X509::Certificate.new(File.read(@custom_ca_cert))
140
+ store.add_cert(ca_cert)
141
+ http.cert_store = store
142
+ end
134
143
  @header.each { |k, v| request[k] = v }
135
144
  request.body = payload
136
145
  handle_response(http.request(request))
@@ -144,16 +153,24 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
144
153
  rescue => e
145
154
  # Stuff that should never happen
146
155
  # For all other errors print out full issues
147
- @logger.error(
148
- "An unknown error occurred sending a bulk request to NewRelic.",
149
- :error_message => e.message,
150
- :error_class => e.class.name,
151
- :backtrace => e.backtrace
152
- )
153
156
  if (should_retry(retries))
154
157
  retries += 1
158
+ @logger.warn(
159
+ "An unknown error occurred sending a bulk request to NewRelic. Retrying...",
160
+ :retries => "attempt #{retries} of #{@max_retries}",
161
+ :error_message => e.message,
162
+ :error_class => e.class.name,
163
+ :backtrace => e.backtrace
164
+ )
155
165
  sleep(1)
156
166
  retry
167
+ else
168
+ @logger.error(
169
+ "An unknown error occurred sending a bulk request to NewRelic. Maximum of attempts reached, dropping logs.",
170
+ :error_message => e.message,
171
+ :error_class => e.class.name,
172
+ :backtrace => e.backtrace
173
+ )
157
174
  end
158
175
  end
159
176
  end
@@ -1,7 +1,7 @@
1
1
  module LogStash
2
2
  module Outputs
3
3
  module NewRelicVersion
4
- VERSION = "1.2.1"
4
+ VERSION = "1.3.0"
5
5
  end
6
6
  end
7
7
  end
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.2.1
4
+ version: 1.3.0
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: 2021-04-22 00:00:00.000000000 Z
11
+ date: 2023-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement