fluent-plugin-newrelic 1.1.3 → 1.1.4

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: 3ee73ce175fb282dc265d9fb7f6e7fd77070e34239a62296c66317dcb8ab1ffc
4
- data.tar.gz: 9c68570a7caf8dd62385f0d7077fc21009d8e37436d340a1b47469071d1ff884
3
+ metadata.gz: 8cb4af63cf04a60335e50efdc0861bb8207a8486abf19c119f19622c0d36f523
4
+ data.tar.gz: c64ccd499c958400b1be3459c7ec9c864515baa7155839f817a6627e5bef14a5
5
5
  SHA512:
6
- metadata.gz: 854481935c1b820b9c59faaed047d9d1aec1ed28cf39c4dc38271bcc9ad1028c61e1aa6b56e1ee6de35e1ac995a45254ebec92298a56f4312068bd667248a40a
7
- data.tar.gz: 90c99413df6d425e7d6339abfe6615ee168368d0729722957ca05e779c2459542f2b0c01cec4a9acc3aa424ff2a07026316033594aec71bfa3a404b32da82c9c
6
+ metadata.gz: da6b7569f2f5555c902673beff340926993167cb68b8f11f6154c80fe48a82158ff7eb41c86828517ee56f1957417822ad25a8203ef18e9a9c4b4121222f93cd
7
+ data.tar.gz: e7bbc86ca57b5c20df3e81c7ff61750b0a8e0cad1424ec22ca1cab875de2159fabb8becb768600b7959cab7cd48a4c69a51af4ba3204fc79ae656932dfac4ead
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  .DS_Store
11
11
  .ruby-version
12
12
  .idea/
13
+ *.gem
@@ -1,14 +1,5 @@
1
1
  # Developing the plugin
2
2
 
3
- ## Set up
4
-
5
- As of September 2019, some supported versions of Fluentd uses Ruby 2.1.10p492, so you'll want to use that to
6
- develop and test with.
7
-
8
- * Install rbenv
9
- * Install an old version of Ruby: `rbenv install 2.1.0`
10
- * Use that older version: `rbenv local 2.1.0`
11
-
12
3
  ## Developing
13
4
 
14
5
  * Install Bundler gem: `gem install bundler`
@@ -18,9 +9,10 @@ develop and test with.
18
9
  * Run tests: `bundle exec rspec`
19
10
  * Build the gem: `gem build newrelic-fluentd-output.gemspec`
20
11
 
21
- **NOTE**: Be mindful that using `log.info` in the plugin causes an unintended Sorcerer's
22
- Apprentice Syndrome style bug where exponentially larger copies of log messages are sent until the
23
- td-agent is unloaded. Super weird, but now you know.
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.
24
16
 
25
17
  ## Testing on MacOS
26
18
 
@@ -31,17 +23,17 @@ td-agent is unloaded. Super weird, but now you know.
31
23
  * `sudo vi /etc/td-agent/td-agent.conf`
32
24
  * Add the following:
33
25
  ```
34
- <match **>
35
- @type newrelic
36
- api_key (your-api-key)
37
- </match>
38
-
39
26
  <source>
40
27
  @type tail
41
28
  format none
42
29
  path /usr/local/var/log/test.log
43
30
  tag test
44
31
  </source>
32
+
33
+ <match test>
34
+ @type newrelic
35
+ api_key (your-api-key)
36
+ </match>
45
37
  ```
46
38
 
47
39
  ### Testing plugin
data/README.md CHANGED
@@ -23,9 +23,12 @@ For more info, review [Fluentd's official documentation](https://docs.fluentd.or
23
23
 
24
24
  ### Required plugin configuration
25
25
 
26
+ Exactly one of the following:
27
+
26
28
  | Property | Description |
27
29
  |---|---|
28
30
  | api_key | your New Relic API Insert key |
31
+ | license_key | your New Relic License key |
29
32
 
30
33
  ### Optional plugin configuration
31
34
 
@@ -45,9 +48,11 @@ in a `log` field, while we want messages in a `message` field.
45
48
 
46
49
  ### Example
47
50
 
48
- Add the following block to your Fluentd config file (with your specific New Relic Insights Insert key), then restart Fluentd.
51
+ Add one of the following blocks to your Fluentd config file (with your specific key), then restart Fluentd.
52
+
53
+ #### Using Insights Inserts Key
49
54
 
50
- Example:
55
+ Example using Insights Insert key:
51
56
  ```rb
52
57
  <match **>
53
58
  @type newrelic
@@ -58,6 +63,18 @@ Example:
58
63
  Getting your New Relic Insights Insert key:
59
64
  `https://insights.newrelic.com/accounts/<ACCOUNT_ID>/manage/api_keys`
60
65
 
66
+ #### Using License Key
67
+ Example using License key:
68
+ ```rb
69
+ <match **>
70
+ @type newrelic
71
+ license_key <NEW_RELIC_LICENSE_KEY>
72
+ </match>
73
+ ```
74
+
75
+ Getting your New Relic license key:
76
+ `https://rpm.newrelic.com/accounts/<ACCOUNT_ID>`
77
+
61
78
  ## Copyright
62
79
 
63
80
  * Copyright(c) 2019 - New Relic
@@ -56,9 +56,10 @@ module Fluent
56
56
  # create initial sockets hash and socket based on config param
57
57
  @end_point = URI.parse(@base_uri)
58
58
  auth = {
59
- @api_key.nil? ? 'X-License_key' : 'X-Insert-Key' =>
59
+ @api_key.nil? ? 'X-License-Key' : 'X-Insert-Key' =>
60
60
  @api_key.nil? ? @license_key : @api_key
61
61
  }
62
+ puts auth
62
63
  @header = {
63
64
  'X-Event-Source' => 'logs',
64
65
  'Content-Encoding' => 'gzip'
@@ -109,6 +110,11 @@ module Fluent
109
110
  end
110
111
  io = StringIO.new
111
112
  gzip = Zlib::GzipWriter.new(io)
113
+
114
+ # Fluentd can run with a version of Ruby (2.1.0) whose to_json method doesn't support non-ASCII characters.
115
+ # So we use Yajl, which can handle all Unicode characters. Apparently this library is what Fluentd uses
116
+ # internally, so it is installed by default with td-agent.
117
+ # See https://github.com/fluent/fluentd/issues/215
112
118
  gzip << Yajl.dump([payload])
113
119
  gzip.close
114
120
  send_payload(io.string)
@@ -124,6 +130,7 @@ module Fluent
124
130
  http = Net::HTTP.new(@end_point.host, 443)
125
131
  http.use_ssl = true
126
132
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
133
+ puts @header
127
134
  request = Net::HTTP::Post.new(@end_point.request_uri, @header)
128
135
  request.body = payload
129
136
  handle_response(http.request(request))
@@ -1,3 +1,3 @@
1
1
  module NewrelicFluentdOutput
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
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.3
4
+ version: 1.1.4
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-09-11 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd