fluent-plugin-scalyr 0.8.10 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +49 -17
- data/Rakefile +10 -6
- data/VERSION +1 -1
- data/fluent-plugin-scalyr.gemspec +11 -7
- data/lib/fluent/plugin/out_scalyr.rb +228 -219
- data/lib/fluent/plugin/{scalyr-exceptions.rb → scalyr_exceptions.rb} +2 -2
- data/lib/fluent/plugin/scalyr_utils.rb +65 -0
- data/test/helper.rb +12 -6
- data/test/test_config.rb +24 -30
- data/test/test_events.rb +297 -141
- data/test/test_handle_response.rb +34 -35
- data/test/test_ssl_verify.rb +101 -10
- data/test/test_utils.rb +100 -0
- metadata +50 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b707a6d76dc806731c45f6a96915936e559c49c79e873c3c5ea5dce4ffbaf288
|
4
|
+
data.tar.gz: a328a42722469673e69d9e7a77e84c65cb1f7235a566076a1316216937a54405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fad3abf458ae0f215f7a29ca3aa4cc167d05811e270c3eace46057ce291307f3b76ef8c13c269b8c43b4564909001e2421dd6ef591188e52c6ed44c22a5ef946
|
7
|
+
data.tar.gz: b8a3268ce7d4d71178ea3356ba47ffd9247cbe3c55d49d436916868076710c4f66719266235d926e314b936bed5544a92de6afdad93a0b33be5d4d0fe0d473cb
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -30,22 +30,6 @@ This can be done by specifying tags such as scalyr.apache, scalyr.maillog etc an
|
|
30
30
|
|
31
31
|
Fluentd tag names will be used for the logfile name in Scalyr.
|
32
32
|
|
33
|
-
Scalyr Parsers and Custom Fields
|
34
|
-
--------------------------------
|
35
|
-
|
36
|
-
You may also need to specify a Scalyr parser for your log message or add custom fields to each log event. This can be done using Fluentd's filter mechanism, in particular the [record_transformer filter](https://docs.fluentd.org/filter/record_transformer).
|
37
|
-
|
38
|
-
For example, if you want to use Scalyr's ```accessLog``` parser for all events with the ```scalyr.access``` tag you would add the following to your fluent.conf file:
|
39
|
-
|
40
|
-
```
|
41
|
-
<filter scalyr.access>
|
42
|
-
@type record_transformer
|
43
|
-
<record>
|
44
|
-
parser accessLog
|
45
|
-
</record>
|
46
|
-
</filter>
|
47
|
-
```
|
48
|
-
|
49
33
|
Plugin Configuration
|
50
34
|
-------------
|
51
35
|
|
@@ -80,6 +64,7 @@ The following configuration options are also supported:
|
|
80
64
|
ssl_verify_peer true
|
81
65
|
ssl_verify_depth 5
|
82
66
|
message_field message
|
67
|
+
parser nil
|
83
68
|
|
84
69
|
max_request_buffer 5500000
|
85
70
|
|
@@ -104,6 +89,32 @@ For some additional examples of configuration for different setups, please refer
|
|
104
89
|
[examples/configs/](https://github.com/scalyr/scalyr-fluentd/tree/master/examples/configs/)
|
105
90
|
directory.
|
106
91
|
|
92
|
+
Scalyr Parsers and Custom Fields
|
93
|
+
--------------------------------
|
94
|
+
|
95
|
+
You may also need to specify a Scalyr parser for your log message or add custom fields to each log event. This can be done using Fluentd's filter mechanism, in particular the [record_transformer filter](https://docs.fluentd.org/filter/record_transformer).
|
96
|
+
|
97
|
+
For example, if you want to use Scalyr's ```accessLog``` parser for all events with the ```scalyr.access``` tag you would add the following to your fluent.conf file:
|
98
|
+
|
99
|
+
```
|
100
|
+
<filter scalyr.access>
|
101
|
+
@type record_transformer
|
102
|
+
<record>
|
103
|
+
parser accessLog
|
104
|
+
</record>
|
105
|
+
</filter>
|
106
|
+
```
|
107
|
+
|
108
|
+
Alternatively, if the same parser can be used for all events sent by the Fluentd output plugin, the parser can be set using the ```parser``` plugin configuration. For example, to use Scalyr's ```accessLog``` parser for all events, use the output plugin configuration:
|
109
|
+
|
110
|
+
```
|
111
|
+
<match scalyr.*>
|
112
|
+
@type scalyr
|
113
|
+
api_write_token YOUR_SCALYR_WRITE_LOGS_TOKEN
|
114
|
+
parser accessLog
|
115
|
+
</match>
|
116
|
+
```
|
117
|
+
|
107
118
|
### Scalyr specific options
|
108
119
|
|
109
120
|
***compression_type*** - compress Scalyr traffic to reduce network traffic. Options are `bz2` and `deflate`. See [here](https://www.scalyr.com/help/scalyr-agent#compressing) for more details. This feature is optional.
|
@@ -116,7 +127,7 @@ directory.
|
|
116
127
|
|
117
128
|
***scalyr_server*** - the Scalyr server to send API requests to. This value is optional and defaults to https://agent.scalyr.com/
|
118
129
|
|
119
|
-
***ssl_ca_bundle_path*** - a path on your server pointing to a valid certificate bundle. This value is optional and defaults to
|
130
|
+
***ssl_ca_bundle_path*** - a path on your server pointing to a valid certificate bundle. This value is optional and defaults to *nil*, which means it will look for a valid certificate bundle on its own.
|
120
131
|
|
121
132
|
**Note:** if the certificate bundle does not contain a certificate chain that verifies the Scalyr SSL certificate then all requests to Scalyr will fail unless ***ssl_verify_peer*** is set to false. If you suspect logging to Scalyr is failing due to an invalid certificate chain, you can grep through the Fluentd output for warnings that contain the message 'certificate verification failed'. The full text of such warnings will look something like this:
|
122
133
|
|
@@ -134,6 +145,8 @@ The cURL project maintains CA certificate bundles automatically converted from m
|
|
134
145
|
|
135
146
|
***message_field*** - Scalyr expects all log events to have a 'message' field containing the contents of a log message. If your event has the log message stored in another field, you can specify the field name here, and the plugin will rename that field to 'message' before sending the data to Scalyr. **Note:** this will override any existing 'message' field if the log record contains both a 'message' field and the field specified by this config option.
|
136
147
|
|
148
|
+
***parser*** - The Scalyr parser to use to parse the 'message' field for each event. This value is optional and defaults to *nil*.
|
149
|
+
|
137
150
|
***max_request_buffer*** - The maximum size in bytes of each request to send to Scalyr. Defaults to 5,500,000 (5.5MB). Fluentd chunks that generate JSON requests larger than the max_request_buffer will be split in to multiple separate requests. **Note:** The maximum size the Scalyr servers accept for this value is 6MB and requests containing data larger than this will be rejected.
|
138
151
|
|
139
152
|
***force_message_encoding*** - Set a specific encoding for all your log messages (defaults to nil). If your log messages are not in UTF-8, this can cause problems when converting the message to JSON in order to send to the Scalyr server. You can avoid these problems by setting an encoding for your log messages so they can be correctly converted.
|
@@ -180,3 +193,22 @@ Which builds the gem and puts it in the pkg directory, then install the Gem usin
|
|
180
193
|
```
|
181
194
|
fluent-gem install pkg/fluent-plugin-scalyr-<VERSION>.gem
|
182
195
|
```
|
196
|
+
|
197
|
+
Publishing a new release to RubyGems
|
198
|
+
------------------------------------
|
199
|
+
|
200
|
+
(for project maintainers)
|
201
|
+
|
202
|
+
To publish a new version to RubyGems, simply make your changes, make sure all the lint checks and
|
203
|
+
tests pass and merge your changes into master.
|
204
|
+
|
205
|
+
After that's done, bump a version in ``VERSION`` file, update ``CHANGELOG.md`` file, add a tag
|
206
|
+
which matches a version in VERSION file (e.g. ``v0.8.10``) and push that tag to the remote:
|
207
|
+
|
208
|
+
```bash
|
209
|
+
git tag v0.8.10
|
210
|
+
git push origin v0.8.10
|
211
|
+
```
|
212
|
+
|
213
|
+
Push of this tag will trigger a Circle CI job which will build the latest version of the gem and
|
214
|
+
publish it to RubyGems.
|
data/Rakefile
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler"
|
2
4
|
Bundler::GemHelper.install_tasks
|
3
5
|
|
4
|
-
require
|
6
|
+
require "rake/testtask"
|
5
7
|
|
6
|
-
Rake::TestTask.new do |
|
7
|
-
|
8
|
-
|
8
|
+
Rake::TestTask.new(:test) do |test|
|
9
|
+
test.libs << "lib" << "test"
|
10
|
+
test.test_files = FileList["test/test_*.rb"]
|
11
|
+
test.verbose = true
|
12
|
+
test.options = "--verbose=verbose"
|
9
13
|
end
|
10
14
|
|
11
|
-
task :
|
15
|
+
task default: [:build]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.15
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
2
4
|
|
3
5
|
Gem::Specification.new do |gem|
|
4
6
|
gem.name = "fluent-plugin-scalyr"
|
@@ -10,16 +12,18 @@ Gem::Specification.new do |gem|
|
|
10
12
|
gem.licenses = ["Apache-2.0"]
|
11
13
|
gem.email = "imron@scalyr.com"
|
12
14
|
gem.platform = Gem::Platform::RUBY
|
13
|
-
gem.files = Dir[
|
15
|
+
gem.files = Dir["AUTHORS", "Gemfile", "LICENSE", "README.md", "Rakefile", "VERSION",
|
16
|
+
"fluent-plugin-scalyr.gemspec", "fluent.conf.sample", "lib/**/*", "test/**/*"]
|
14
17
|
gem.test_files = Dir.glob("{test,spec,features}/**/*")
|
15
|
-
gem.executables = Dir.glob("bin/*").map{
|
16
|
-
gem.require_paths = [
|
17
|
-
gem.add_dependency "fluentd", [">= 0.14.0", "< 2"]
|
18
|
+
gem.executables = Dir.glob("bin/*").map {|f| File.basename(f) }
|
19
|
+
gem.require_paths = ["lib"]
|
18
20
|
gem.add_dependency "ffi", "1.9.25"
|
21
|
+
gem.add_dependency "fluentd", [">= 0.14.0", "< 2"]
|
19
22
|
gem.add_dependency "rbzip2", "0.3.0"
|
20
23
|
gem.add_dependency "zlib"
|
24
|
+
gem.add_development_dependency "bundler", "~> 1.9"
|
25
|
+
gem.add_development_dependency "flexmock", "~> 1.2"
|
21
26
|
gem.add_development_dependency "rake", "~> 0.9"
|
27
|
+
gem.add_development_dependency "rubocop", "~> 0.4"
|
22
28
|
gem.add_development_dependency "test-unit", "~> 3.0"
|
23
|
-
gem.add_development_dependency "flexmock", "~> 1.2"
|
24
|
-
gem.add_development_dependency "bundler", "~> 1.9"
|
25
29
|
end
|