logstash-output-newrelic 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/DEVELOPER.md +8 -5
- data/README.md +10 -2
- data/lib/logstash/outputs/{newrelic_internal.rb → newrelic.rb} +8 -8
- data/lib/logstash/outputs/newrelic_version/version.rb +7 -0
- data/logstash-output-newrelic.gemspec +4 -5
- data/spec/outputs/{newrelic_internal_spec.rb → newrelic_spec.rb} +9 -7
- metadata +9 -10
- data/lib/logstash/outputs/newrelic_internal_version/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 750803d3594bfcf428aa32102cdb23679ae0f91a2efa5dc970e7520b8550fdaa
|
4
|
+
data.tar.gz: 101d475ad8adabc356c8041f8ef97481f20aba9041aac4df78e003b524e79196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b770681904d2286b9cdb63231af2e1dffe6f438308796d4b1171916d39ebd98c4f3b702f924305fab7ec4d8965da6ee1f9c444e012bb20e42e5f057d8076dff
|
7
|
+
data.tar.gz: cab594f0010916cbbaf54403df7d3f431a5999fdac6418ca52ee7730b4981e55700658d5275fcd33055f296ba310e63f32610ab9f1636d6ab1ecea95f239345a
|
data/DEVELOPER.md
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* Write tests and production code!
|
13
13
|
* Bump version: edit version file `version.rb`
|
14
14
|
* Run tests: `jruby -S bundle exec rspec`
|
15
|
-
* Build the gem: `jruby -S gem build logstash-output-newrelic
|
15
|
+
* Build the gem: `jruby -S gem build logstash-output-newrelic.gemspec`
|
16
16
|
|
17
17
|
## Pushing changes to the public repo
|
18
18
|
After updating the New Relic repo with changes, changes will need to be pushed to the public GitHub repo at: https://github.com/newrelic/newrelic-fluent-bit-output
|
@@ -24,14 +24,17 @@ After updating the New Relic repo with changes, changes will need to be pushed t
|
|
24
24
|
|
25
25
|
# Testing it with a local Logstash install
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
Note: you may need to run the following commands outside of your checkout, since these should not
|
28
|
+
be run with the JRuby version that you've configured your checkout to use (by using rbenv).
|
29
|
+
|
30
|
+
* Remove previous version: `logstash-plugin remove logstash-output-newrelic`
|
31
|
+
* Add new version: `logstash-plugin install logstash-output-newrelic-<version>.gem`
|
29
32
|
* Restart logstash: For Homebrew: `brew services restart logstash`
|
30
33
|
* Cause a change that you've configured Logstash to pick up (for instance, append to a file you're having it monitor)
|
31
34
|
* Look in `https://staging-one.newrelic.com/launcher/logger.log-launcher` for your log message
|
32
35
|
|
33
36
|
# Push changes to RubyGems
|
34
|
-
After updating the source code and gem version in `version.rb`, push the changes to RubyGems. Note, you must be a gem owner to publish changes on [RubyGems.org](https://rubygems.org/profiles/NR-LOGGING)
|
37
|
+
After updating the source code and gem version in `version.rb`, push the changes to RubyGems. There is an older version of the gem that we do not want to overwrite — `version 0.9.1`. Please be sure you are publishing changes to the correct gem i.e. `version 1.0.0` or higher. Note, you must be a gem owner to publish changes on [RubyGems.org](https://rubygems.org/profiles/NR-LOGGING). Once you've created the account, you will need to run `gem signin` to login to RubyGems via the command line.
|
35
38
|
|
36
39
|
* Build the gem: `gem build logstash-output-newrelic.gemspec`
|
37
|
-
* Publish the gem: `gem push logstash-output-newrelic
|
40
|
+
* Publish the gem: `gem push logstash-output-newrelic-<VERSION>.gem` with the updated version (ex: `gem push logstash-output-newrelic-1.0.0.gem`)
|
data/README.md
CHANGED
@@ -4,7 +4,15 @@ This is a plugin for [Logstash](https://github.com/elastic/logstash) that output
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
Install the New Relic Logstash plugin using the following command:</br>
|
7
|
-
`logstash-plugin install logstash-output-newrelic
|
7
|
+
`logstash-plugin install logstash-output-newrelic`
|
8
|
+
|
9
|
+
(Optional) If you are interested in installing the gem directly, run the following command. If you want a specific version, specify it by appending the `-v <VERSION>` option.<br/>
|
10
|
+
`gem install logstash-output-newrelic`
|
11
|
+
|
12
|
+
```
|
13
|
+
Old version: 0.9.1 (unmaintained)
|
14
|
+
Current: 1.0.0
|
15
|
+
```
|
8
16
|
|
9
17
|
## Configuration
|
10
18
|
|
@@ -17,7 +25,7 @@ Get your API Insert Key:
|
|
17
25
|
Example:
|
18
26
|
```rb
|
19
27
|
output {
|
20
|
-
|
28
|
+
newrelic {
|
21
29
|
api_key => "<API_INSERT_KEY>"
|
22
30
|
}
|
23
31
|
}
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/outputs/base"
|
3
|
-
require "logstash/outputs/
|
3
|
+
require "logstash/outputs/newrelic_version/version"
|
4
4
|
require 'net/http'
|
5
5
|
require 'uri'
|
6
6
|
require 'zlib'
|
7
7
|
require 'json'
|
8
8
|
require 'java'
|
9
9
|
|
10
|
-
class LogStash::Outputs::
|
10
|
+
class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
|
11
11
|
java_import java.util.concurrent.Executors;
|
12
12
|
java_import java.util.concurrent.Semaphore;
|
13
13
|
|
14
|
-
config_name "
|
14
|
+
config_name "newrelic"
|
15
15
|
|
16
16
|
config :api_key, :validate => :password, :required => true
|
17
17
|
config :retry_seconds, :validate => :number, :default => 5
|
18
18
|
config :max_delay, :validate => :number, :default => 30
|
19
19
|
config :retries, :validate => :number, :default => 5
|
20
20
|
config :concurrent_requests, :validate => :number, :default => 1
|
21
|
-
config :base_uri, :validate => :string, :default => "https://
|
21
|
+
config :base_uri, :validate => :string, :default => "https://log-api.newrelic.com/log/v1"
|
22
22
|
|
23
23
|
# TODO: do we need to define "concurrency"? https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html
|
24
24
|
|
@@ -72,15 +72,15 @@ class LogStash::Outputs::NewRelicInternal < LogStash::Outputs::Base
|
|
72
72
|
payload.push(encode(event.to_hash))
|
73
73
|
end
|
74
74
|
payload = {
|
75
|
-
'logs' => payload,
|
76
75
|
'common' => {
|
77
76
|
'attributes' => {
|
78
77
|
'plugin' => {
|
79
78
|
'type' => 'logstash',
|
80
|
-
'version' => LogStash::Outputs::
|
79
|
+
'version' => LogStash::Outputs::NewRelicVersion::VERSION,
|
81
80
|
}
|
82
81
|
}
|
83
|
-
}
|
82
|
+
},
|
83
|
+
'logs' => payload
|
84
84
|
}
|
85
85
|
@semaphor.acquire()
|
86
86
|
execute = @executor.java_method :submit, [java.lang.Runnable]
|
@@ -123,4 +123,4 @@ class LogStash::Outputs::NewRelicInternal < LogStash::Outputs::Base
|
|
123
123
|
request.body = payload
|
124
124
|
http.request(request)
|
125
125
|
end
|
126
|
-
end # class LogStash::Outputs::
|
126
|
+
end # class LogStash::Outputs::NewRelic
|
@@ -1,15 +1,14 @@
|
|
1
1
|
lib = File.expand_path('../lib/', __FILE__)
|
2
2
|
$:.unshift lib unless $:.include?(lib)
|
3
3
|
|
4
|
-
require 'logstash/outputs/
|
4
|
+
require 'logstash/outputs/newrelic_version/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'logstash-output-newrelic'
|
8
|
-
s.version = LogStash::Outputs::
|
8
|
+
s.version = LogStash::Outputs::NewRelicVersion::VERSION
|
9
9
|
s.licenses = ['Apache-2.0']
|
10
|
-
s.summary =
|
11
|
-
s.
|
12
|
-
s.homepage = 'https://source.datanerd.us/logging/logstash-output-newrelic'
|
10
|
+
s.summary = "Sends Lostash events to New Relic"
|
11
|
+
s.homepage = 'https://github.com/newrelic/logstash-output-plugin'
|
13
12
|
s.authors = ['New Relic Logging Team']
|
14
13
|
s.email = 'logging-team@newrelic.com'
|
15
14
|
s.require_paths = ['lib']
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/devutils/rspec/spec_helper"
|
3
|
-
require "logstash/outputs/
|
4
|
-
require "logstash/outputs/
|
3
|
+
require "logstash/outputs/newrelic"
|
4
|
+
require "logstash/outputs/newrelic_version/version"
|
5
5
|
require "logstash/codecs/plain"
|
6
6
|
require "logstash/event"
|
7
7
|
require "webmock/rspec"
|
8
8
|
require "zlib"
|
9
9
|
|
10
|
-
describe LogStash::Outputs::
|
10
|
+
describe LogStash::Outputs::NewRelic do
|
11
11
|
let (:api_key) { "someAccountKey" }
|
12
12
|
let (:base_uri) { "https://testing-example-collector.com" }
|
13
13
|
let (:retry_seconds) { 0 }
|
@@ -40,7 +40,7 @@ describe LogStash::Outputs::NewRelicInternal do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
before(:each) do
|
43
|
-
@newrelic_output = LogStash::Plugin.lookup("output", "
|
43
|
+
@newrelic_output = LogStash::Plugin.lookup("output", "newrelic").new(simple_config)
|
44
44
|
@newrelic_output.register
|
45
45
|
end
|
46
46
|
|
@@ -53,7 +53,7 @@ describe LogStash::Outputs::NewRelicInternal do
|
|
53
53
|
no_api_key_config = {
|
54
54
|
}
|
55
55
|
|
56
|
-
expect { LogStash::Plugin.lookup("output", "
|
56
|
+
expect { LogStash::Plugin.lookup("output", "newrelic").new(no_api_key_config) }.to raise_error LogStash::ConfigurationError
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -83,8 +83,10 @@ describe LogStash::Outputs::NewRelicInternal do
|
|
83
83
|
wait_for(a_request(:post, base_uri)
|
84
84
|
.with { |request|
|
85
85
|
data = multiple_gzipped_messages(request.body)[0]
|
86
|
+
data.keys[0] == 'common' &&
|
87
|
+
data.keys[1] == 'logs' &&
|
86
88
|
data['common']['attributes']['plugin']['type'] == 'logstash' &&
|
87
|
-
data['common']['attributes']['plugin']['version'] == LogStash::Outputs::
|
89
|
+
data['common']['attributes']['plugin']['version'] == LogStash::Outputs::NewRelicVersion::VERSION })
|
88
90
|
.to have_been_made
|
89
91
|
end
|
90
92
|
|
@@ -217,7 +219,7 @@ describe LogStash::Outputs::NewRelicInternal do
|
|
217
219
|
# Create a new plugin with this specific config that has longer retry sleep
|
218
220
|
# configuration than we normally want
|
219
221
|
@newrelic_output&.shutdown
|
220
|
-
@newrelic_output = LogStash::Plugin.lookup("output", "
|
222
|
+
@newrelic_output = LogStash::Plugin.lookup("output", "newrelic").new(specific_config)
|
221
223
|
@newrelic_output.register
|
222
224
|
|
223
225
|
expect(@newrelic_output.sleep_duration(0)).to equal(5)
|
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.0.
|
4
|
+
version: 1.0.1
|
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: 2019-06-
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,8 +80,7 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
84
|
-
events
|
83
|
+
description:
|
85
84
|
email: logging-team@newrelic.com
|
86
85
|
executables: []
|
87
86
|
extensions: []
|
@@ -93,11 +92,11 @@ files:
|
|
93
92
|
- Gemfile
|
94
93
|
- LICENSE
|
95
94
|
- README.md
|
96
|
-
- lib/logstash/outputs/
|
97
|
-
- lib/logstash/outputs/
|
95
|
+
- lib/logstash/outputs/newrelic.rb
|
96
|
+
- lib/logstash/outputs/newrelic_version/version.rb
|
98
97
|
- logstash-output-newrelic.gemspec
|
99
|
-
- spec/outputs/
|
100
|
-
homepage: https://
|
98
|
+
- spec/outputs/newrelic_spec.rb
|
99
|
+
homepage: https://github.com/newrelic/logstash-output-plugin
|
101
100
|
licenses:
|
102
101
|
- Apache-2.0
|
103
102
|
metadata:
|
@@ -122,6 +121,6 @@ rubyforge_project:
|
|
122
121
|
rubygems_version: 2.7.6
|
123
122
|
signing_key:
|
124
123
|
specification_version: 4
|
125
|
-
summary:
|
124
|
+
summary: Sends Lostash events to New Relic
|
126
125
|
test_files:
|
127
|
-
- spec/outputs/
|
126
|
+
- spec/outputs/newrelic_spec.rb
|