fluent-plugin-newrelic 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/Rakefile +18 -1
- data/lib/fluent/plugin/out_newrelic.rb +2 -4
- data/lib/newrelic-fluentd-output/version.rb +1 -1
- data/merge-to-master-pipeline.yml +57 -0
- data/newrelic-fluentd-output.gemspec +1 -0
- data/pr-pipeline.yml +33 -0
- metadata +19 -6
- data/.rspec +0 -2
- data/DEVELOPER.md +0 -77
- data/grandcentral.yml +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7132fae0051be2d81093419b87196ecc3b2b07047ab40dae17998f0951ab61f
|
4
|
+
data.tar.gz: 86bb2c5967400fc48f8ccbae6fcb392b3900a55565d0f788d91d4dd53c679701
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58b0684282ed9d718483f986f6bdd8d3be52179ceb7c754fd1a5483661d25596f2063592db1c6d7bbc9bb3773aff22fa7e6533f602f220aab5ff7b71b12b4f75
|
7
|
+
data.tar.gz: cba6c35190cc781d3ecc083981faf08e4adac7daf2a3ad7b3afe6c3c47ea0babb012db0bba82fa7e88bb56415342d0894e6492223b5699d630faec546e0df59f
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -34,11 +34,11 @@ Exactly one of the following:
|
|
34
34
|
|
35
35
|
| Property | Description | Default value |
|
36
36
|
|---|---|---|
|
37
|
-
| base_uri | New Relic ingestion endpoint |
|
37
|
+
| base_uri | New Relic ingestion endpoint | `https://log-api.newrelic.com/log/v1` |
|
38
38
|
|
39
39
|
### EU plugin configuration
|
40
40
|
|
41
|
-
If you are running this plugin in the eu set the `base_uri` to `
|
41
|
+
If you are running this plugin in the eu set the `base_uri` to `https://log-api.eu.newrelic.com/log/v1`.
|
42
42
|
|
43
43
|
### Fields
|
44
44
|
|
data/Rakefile
CHANGED
@@ -1,2 +1,19 @@
|
|
1
|
-
require "bundler
|
1
|
+
require "bundler"
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require "rake/testtask"
|
5
|
+
require 'ci/reporter/rake/test_unit'
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs.push("lib", "test")
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
t.verbose = true
|
11
|
+
t.warning = true
|
12
|
+
end
|
13
|
+
|
14
|
+
namespace :ci do
|
15
|
+
task :all => ['ci:setup:testunit', 'test']
|
16
|
+
end
|
17
|
+
|
18
|
+
task default: ["ci:all"]
|
2
19
|
|
@@ -50,16 +50,15 @@ module Fluent
|
|
50
50
|
def configure(conf)
|
51
51
|
super
|
52
52
|
if @api_key.nil? && @license_key.nil?
|
53
|
-
raise Fluent::ConfigError.new("'api_key' or
|
53
|
+
raise Fluent::ConfigError.new("'api_key' or 'license_key' parameter is required")
|
54
54
|
end
|
55
55
|
|
56
56
|
# create initial sockets hash and socket based on config param
|
57
57
|
@end_point = URI.parse(@base_uri)
|
58
58
|
auth = {
|
59
59
|
@api_key.nil? ? 'X-License-Key' : 'X-Insert-Key' =>
|
60
|
-
@api_key.nil? ? @license_key : @api_key
|
60
|
+
@api_key.nil? ? @license_key : @api_key
|
61
61
|
}
|
62
|
-
puts auth
|
63
62
|
@header = {
|
64
63
|
'X-Event-Source' => 'logs',
|
65
64
|
'Content-Encoding' => 'gzip'
|
@@ -130,7 +129,6 @@ module Fluent
|
|
130
129
|
http = Net::HTTP.new(@end_point.host, 443)
|
131
130
|
http.use_ssl = true
|
132
131
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
133
|
-
puts @header
|
134
132
|
request = Net::HTTP::Post.new(@end_point.request_uri, @header)
|
135
133
|
request.body = payload
|
136
134
|
handle_response(http.request(request))
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Run any time a commit is merged to the 'master' branch
|
2
|
+
trigger:
|
3
|
+
- master
|
4
|
+
|
5
|
+
# There is a separate pipeline for PRs (it does not do deploys)
|
6
|
+
pr: none
|
7
|
+
|
8
|
+
pool:
|
9
|
+
vmImage: 'ubuntu-latest'
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- task: DownloadSecureFile@1
|
13
|
+
name: "rubyGemsCredentials"
|
14
|
+
inputs:
|
15
|
+
secureFile: 'credentials'
|
16
|
+
|
17
|
+
- task: UseRubyVersion@0
|
18
|
+
inputs:
|
19
|
+
versionSpec: '>= 2.5'
|
20
|
+
|
21
|
+
- script: |
|
22
|
+
gem install bundler
|
23
|
+
bundle update
|
24
|
+
bundle install --retry=3 --jobs=4
|
25
|
+
displayName: 'bundle install'
|
26
|
+
|
27
|
+
- task: Bash@3
|
28
|
+
displayName: 'Run tests'
|
29
|
+
inputs:
|
30
|
+
targetType: 'inline'
|
31
|
+
script: |
|
32
|
+
bundle exec rake
|
33
|
+
|
34
|
+
- task: PublishTestResults@2
|
35
|
+
inputs:
|
36
|
+
testResultsFormat: 'JUnit'
|
37
|
+
testResultsFiles: '**/TEST-*.xml'
|
38
|
+
mergeTestResults: true
|
39
|
+
failTaskOnFailedTests: true
|
40
|
+
testRunTitle: 'Publish tests'
|
41
|
+
|
42
|
+
- task: Bash@3
|
43
|
+
displayName: 'Build gem'
|
44
|
+
inputs:
|
45
|
+
targetType: 'inline'
|
46
|
+
script: |
|
47
|
+
gem build newrelic-fluentd-output.gemspec
|
48
|
+
|
49
|
+
- task: Bash@3
|
50
|
+
displayName: 'Publish gem to RubyGems'
|
51
|
+
inputs:
|
52
|
+
targetType: 'inline'
|
53
|
+
script: |
|
54
|
+
eval "$(rbenv init -)"
|
55
|
+
mv $(rubyGemsCredentials.secureFilePath) ~/.gem/credentials
|
56
|
+
sudo chmod 600 ~/.gem/credentials
|
57
|
+
gem push fluent-plugin-newrelic-*.gem
|
data/pr-pipeline.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
pr:
|
2
|
+
branches:
|
3
|
+
include:
|
4
|
+
- '*'
|
5
|
+
|
6
|
+
pool:
|
7
|
+
vmImage: 'ubuntu-latest'
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- task: UseRubyVersion@0
|
11
|
+
inputs:
|
12
|
+
versionSpec: '>= 2.5'
|
13
|
+
|
14
|
+
- script: |
|
15
|
+
gem install bundler
|
16
|
+
bundle update
|
17
|
+
bundle install --retry=3 --jobs=4
|
18
|
+
displayName: 'bundle install'
|
19
|
+
|
20
|
+
- task: Bash@3
|
21
|
+
displayName: 'Run tests'
|
22
|
+
inputs:
|
23
|
+
targetType: 'inline'
|
24
|
+
script: |
|
25
|
+
bundle exec rake
|
26
|
+
|
27
|
+
- task: PublishTestResults@2
|
28
|
+
inputs:
|
29
|
+
testResultsFormat: 'JUnit'
|
30
|
+
testResultsFiles: '**/TEST-*.xml'
|
31
|
+
mergeTestResults: true
|
32
|
+
failTaskOnFailedTests: true
|
33
|
+
testRunTitle: 'Publish tests'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-newrelic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- New Relic Logging Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec_junit_formatter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- logging-team@newrelic.com
|
@@ -89,17 +103,16 @@ extra_rdoc_files: []
|
|
89
103
|
files:
|
90
104
|
- ".dockerignore"
|
91
105
|
- ".gitignore"
|
92
|
-
- ".rspec"
|
93
|
-
- DEVELOPER.md
|
94
106
|
- Dockerfile
|
95
107
|
- Gemfile
|
96
108
|
- LICENSE
|
97
109
|
- README.md
|
98
110
|
- Rakefile
|
99
|
-
- grandcentral.yml
|
100
111
|
- lib/fluent/plugin/out_newrelic.rb
|
101
112
|
- lib/newrelic-fluentd-output/version.rb
|
113
|
+
- merge-to-master-pipeline.yml
|
102
114
|
- newrelic-fluentd-output.gemspec
|
115
|
+
- pr-pipeline.yml
|
103
116
|
homepage: https://github.com/newrelic/newrelic-fluentd-output
|
104
117
|
licenses:
|
105
118
|
- Apache-2.0
|
@@ -119,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
132
|
- !ruby/object:Gem::Version
|
120
133
|
version: '0'
|
121
134
|
requirements: []
|
122
|
-
rubygems_version: 3.0.
|
135
|
+
rubygems_version: 3.0.3
|
123
136
|
signing_key:
|
124
137
|
specification_version: 4
|
125
138
|
summary: Sends FluentD events to New Relic
|
data/.rspec
DELETED
data/DEVELOPER.md
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# Developing the plugin
|
2
|
-
|
3
|
-
## Developing
|
4
|
-
|
5
|
-
* Install Bundler gem: `gem install bundler`
|
6
|
-
* Install dependencies: `bundle install`
|
7
|
-
* Write tests and production code!
|
8
|
-
* Bump version: edit version file `version.rb`
|
9
|
-
* Run tests: `bundle exec rspec`
|
10
|
-
* Build the gem: `gem build newrelic-fluentd-output.gemspec`
|
11
|
-
|
12
|
-
**NOTE**: Be mindful that if you are using 'match **', that using `log.info` in the plugin can cause an unintended
|
13
|
-
Sorcerer's Apprentice Syndrome issue where exponentially larger copies of log messages are sent until the
|
14
|
-
td-agent is unloaded. To prevent this, use match tags specific to your source (so use `<match tag_from_your_source>`
|
15
|
-
instead of `<match **>`), so that your output plugin does not also pick up things that Fluentd logs.
|
16
|
-
|
17
|
-
## Testing on MacOS
|
18
|
-
|
19
|
-
### Install Fluentd
|
20
|
-
* `brew cask install td-agent`
|
21
|
-
|
22
|
-
### Configure Fluentd
|
23
|
-
* `sudo vi /etc/td-agent/td-agent.conf`
|
24
|
-
* Add the following:
|
25
|
-
```
|
26
|
-
<source>
|
27
|
-
@type tail
|
28
|
-
format none
|
29
|
-
path /usr/local/var/log/test.log
|
30
|
-
tag test
|
31
|
-
</source>
|
32
|
-
|
33
|
-
<match test>
|
34
|
-
@type newrelic
|
35
|
-
api_key (your-api-key)
|
36
|
-
</match>
|
37
|
-
```
|
38
|
-
|
39
|
-
### Testing plugin
|
40
|
-
* Stop Fluentd: `sudo launchctl unload /Library/LaunchDaemons/td-agent.plist`
|
41
|
-
* Remove previous version: `sudo /opt/td-agent/usr/sbin/td-agent-gem uninstall fluent-plugin-newrelic`
|
42
|
-
* Add new version: `sudo /opt/td-agent/usr/sbin/td-agent-gem install fluent-plugin-newrelic-<version>.gem`
|
43
|
-
* Start Fluentd: `sudo launchctl load /Library/LaunchDaemons/td-agent.plist`
|
44
|
-
* Make sure things start up OK: `tail -f /var/log/td-agent/td-agent.log`
|
45
|
-
* Cause a change that you've configured Fluentd to pick up: (`echo "FluentdTest" >> /usr/local/var/log/test.log`
|
46
|
-
* Look in `https://one.newrelic.com/launcher/logger.log-launcher` for your log message ("FluentdTest")
|
47
|
-
|
48
|
-
## Pushing changes to the public repo
|
49
|
-
|
50
|
-
After updating the New Relic repo with changes, changes will need to be pushed to the public GitHub repo
|
51
|
-
at: https://github.com/newrelic/newrelic-fluentd-output
|
52
|
-
|
53
|
-
Make sure you have the public set up as a remote called `public`:
|
54
|
-
```
|
55
|
-
git remote add public git@github.com:newrelic/newrelic-fluentd-output.git
|
56
|
-
```
|
57
|
-
|
58
|
-
Sync:
|
59
|
-
```
|
60
|
-
git checkout --orphan single-commit-for-public-sync && \
|
61
|
-
# Remove things we don't want sent to the public-sync repo \
|
62
|
-
rm grandcentral.yml DEVELOPER.md && \
|
63
|
-
# Create a single commit and force push it, overwriting the remote master \
|
64
|
-
git commit -am "Mirrored commit" && \
|
65
|
-
git push --force public single-commit-for-public-sync:master && \
|
66
|
-
# Clean up \
|
67
|
-
git checkout master && \
|
68
|
-
git branch -D single-commit-for-public-sync
|
69
|
-
```
|
70
|
-
|
71
|
-
# Push changes to RubyGems
|
72
|
-
After updating the source code and gem version in `version.rb`, push the changes to RubyGems.
|
73
|
-
Note, you must be a gem owner to publish changes on [RubyGems.org](https://rubygems.org/profiles/NR-LOGGING)
|
74
|
-
|
75
|
-
* Build the gem: `gem build newrelic-fluentd-output.gemspec`
|
76
|
-
* Publish the gem: `gem push fluent-plugin-newrelic-<VERSION>.gem`
|
77
|
-
with the updated version (example: `gem push fluent-plugin-newrelic-0.2.2.gem`)
|
data/grandcentral.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
slack_channel: logging-notifications
|
2
|
-
deploy_mechanism: none
|
3
|
-
test_suites:
|
4
|
-
- command: |
|
5
|
-
mkdir -p ~/.gem
|
6
|
-
curl -u $ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD https://artifacts.datanerd.us/api/gems/newrelic-gems-local/api/v1/api_key.yaml -o ~/.gem/credentials
|
7
|
-
chmod 0600 ~/.gem/credentials
|
8
|
-
bundle install && bundle exec rspec
|
9
|
-
environment:
|
10
|
-
dockerfile: Dockerfile
|
11
|
-
name: Unit Tests
|
12
|
-
build:
|
13
|
-
environment:
|
14
|
-
dockerfile: Dockerfile
|
15
|
-
secret_env_vars:
|
16
|
-
- name: ARTIFACTORY_USERNAME
|
17
|
-
shared_path: artifactory
|
18
|
-
- name: ARTIFACTORY_PASSWORD
|
19
|
-
shared_path: artifactory
|
20
|
-
publish:
|
21
|
-
command: |
|
22
|
-
mkdir -p ~/.gem
|
23
|
-
curl -u $ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD https://artifacts.datanerd.us/api/gems/newrelic-gems-local/api/v1/api_key.yaml -o ~/.gem/credentials
|
24
|
-
chmod 0600 ~/.gem/credentials
|
25
|
-
bundle install
|
26
|
-
gem release --host https://artifacts.datanerd.us/api/gems/newrelic-gems-local
|
27
|
-
read_version:
|
28
|
-
command: cat ./lib/newrelic-fluentd-output/version.rb | grep VERSION | awk '{
|
29
|
-
gsub("\"", "", $3); print $3 }'
|