fluent-plugin-scalyr 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +6 -3
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_scalyr.rb +18 -0
- data/test/test_config.rb +15 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 525ad76a1b5dffcc9e95054ce47518f236b09f42
|
4
|
+
data.tar.gz: c6e7fc32d30c1af2c90a1370bf7acd52191e9725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7906fea7f77596e7be212f82759970b3ca68db9fa9a192bfdced94d6f02342a76e0ce37cb2396d813dd3d4f24abe2214f437a0637aea1605911aa34bb0bcd5b
|
7
|
+
data.tar.gz: 8b18d99f72bdc39d0043d93cb37aa4cfaf71ea67ecba0003281ae567689089d6ed5ec15c41242abd76242b5b5b821c75172815dfc27dd75e7755a82faae85d6e
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Fluentd tag names will be used for the logfile name in Scalyr.
|
|
33
33
|
Scalyr Parsers and Custom Fields
|
34
34
|
--------------------------------
|
35
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](
|
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
37
|
|
38
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
39
|
|
@@ -67,6 +67,7 @@ The following configuration options are also supported:
|
|
67
67
|
#scalyr specific options
|
68
68
|
api_write_token YOUR_SCALYR_WRITE_TOKEN
|
69
69
|
compression_type bz2
|
70
|
+
use_hostname_for_serverhost true
|
70
71
|
server_attributes {
|
71
72
|
"serverHost": "front-1",
|
72
73
|
"serverType": "frontend",
|
@@ -98,7 +99,7 @@ The following configuration options are also supported:
|
|
98
99
|
</match>
|
99
100
|
```
|
100
101
|
|
101
|
-
|
102
|
+
### Scalyr specific options
|
102
103
|
|
103
104
|
***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.
|
104
105
|
|
@@ -106,6 +107,8 @@ The following configuration options are also supported:
|
|
106
107
|
|
107
108
|
***server_attributes*** - a JSON hash containing custom server attributes you want to include with each log request. This value is optional and defaults to *nil*.
|
108
109
|
|
110
|
+
***use_hostname_for_serverhost*** - if `true` then if `server_attributes` is nil or it does *not* include a field called `serverHost` then the plugin will add the `serverHost` field with the value set to the hostname that fluentd is running on. Defaults to `true`.
|
111
|
+
|
109
112
|
***scalyr_server*** - the Scalyr server to send API requests to. This value is optional and defaults to https://agent.scalyr.com/
|
110
113
|
|
111
114
|
***ssl_ca_bundle_path*** - a path on your server pointing to a valid certificate bundle. This value is optional and defaults to */etc/ssl/certs/ca-bundle.crt*.
|
@@ -132,7 +135,7 @@ The cURL project maintains CA certificate bundles automatically converted from m
|
|
132
135
|
|
133
136
|
***replace_invalid_utf8*** - If this value is true and ***force_message_encoding*** is set to 'UTF-8' then all invalid UTF-8 sequences in log messages will be replaced with <?>. Defaults to false. This flag has no effect if ***force_message_encoding*** is not set to 'UTF-8'.
|
134
137
|
|
135
|
-
|
138
|
+
### Buffer options
|
136
139
|
|
137
140
|
***retry_max_times*** - the maximum number of times to retry a failed post request before giving up. Defaults to *40*.
|
138
141
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.8
|
@@ -26,6 +26,7 @@ require 'rbzip2'
|
|
26
26
|
require 'stringio'
|
27
27
|
require 'zlib'
|
28
28
|
require 'securerandom'
|
29
|
+
require 'socket'
|
29
30
|
require 'thread'
|
30
31
|
|
31
32
|
module Scalyr
|
@@ -36,6 +37,7 @@ module Scalyr
|
|
36
37
|
|
37
38
|
config_param :api_write_token, :string
|
38
39
|
config_param :server_attributes, :hash, :default => nil
|
40
|
+
config_param :use_hostname_for_serverhost, :bool, :default => true
|
39
41
|
config_param :scalyr_server, :string, :default => "https://agent.scalyr.com/"
|
40
42
|
config_param :ssl_ca_bundle_path, :string, :default => "/etc/ssl/certs/ca-bundle.crt"
|
41
43
|
config_param :ssl_verify_peer, :bool, :default => true
|
@@ -109,6 +111,22 @@ module Scalyr
|
|
109
111
|
@server_attributes = new_attributes
|
110
112
|
end
|
111
113
|
|
114
|
+
# See if we should use the hostname as the server_attributes.serverHost
|
115
|
+
if @use_hostname_for_serverhost
|
116
|
+
|
117
|
+
# ensure server_attributes is not nil
|
118
|
+
if @server_attributes.nil?
|
119
|
+
@server_attributes = {}
|
120
|
+
end
|
121
|
+
|
122
|
+
# only set serverHost if it doesn't currently exist in server_attributes
|
123
|
+
# Note: Use strings rather than symbols for the key, because keys coming
|
124
|
+
# from the config file will be strings
|
125
|
+
if !@server_attributes.key? 'serverHost'
|
126
|
+
@server_attributes['serverHost'] = Socket.gethostname
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
112
130
|
@scalyr_server << '/' unless @scalyr_server.end_with?('/')
|
113
131
|
|
114
132
|
@add_events_uri = URI @scalyr_server + "addEvents"
|
data/test/test_config.rb
CHANGED
@@ -17,12 +17,15 @@
|
|
17
17
|
|
18
18
|
|
19
19
|
require 'helper'
|
20
|
+
require 'socket'
|
20
21
|
|
21
22
|
class ConfigTest < Scalyr::ScalyrOutTest
|
22
23
|
|
23
24
|
def test_default_params
|
24
25
|
d = create_driver
|
25
|
-
|
26
|
+
hostname = Socket.gethostname
|
27
|
+
assert_not_nil( d.instance.server_attributes, "Default server_attributes should not be nil" )
|
28
|
+
assert_equal( hostname, d.instance.server_attributes['serverHost'], "Default serverHost is not hostname" )
|
26
29
|
assert( d.instance.ssl_verify_peer, "Default ssl_verify_peer should be true" )
|
27
30
|
|
28
31
|
#check default buffer limits because they are set outside of the config_set_default
|
@@ -30,6 +33,17 @@ class ConfigTest < Scalyr::ScalyrOutTest
|
|
30
33
|
assert_equal( 1024, d.instance.buffer.buffer_queue_limit, "Buffer queue limit should be 1024" )
|
31
34
|
end
|
32
35
|
|
36
|
+
def test_custom_serverhost_not_overwritten
|
37
|
+
hostname = "customHost"
|
38
|
+
d = create_driver CONFIG + "server_attributes { \"serverHost\":\"#{hostname}\" }\nuse_hostname_for_serverhost true"
|
39
|
+
assert_equal( hostname, d.instance.server_attributes['serverHost'], "Custom serverHost should not be overwritten" )
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_configure_use_hostname_for_serverhost
|
43
|
+
d = create_driver CONFIG + 'use_hostname_for_serverhost false'
|
44
|
+
assert_nil( d.instance.server_attributes, "Default server_attributes should be nil" )
|
45
|
+
end
|
46
|
+
|
33
47
|
def test_configure_ssl_verify_peer
|
34
48
|
d = create_driver CONFIG + 'ssl_verify_peer false'
|
35
49
|
assert( !d.instance.ssl_verify_peer, "Config failed to set ssl_verify_peer" )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-scalyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Imron Alston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -169,13 +169,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.6.10
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Scalyr plugin for fluentd
|
176
176
|
test_files:
|
177
|
-
- test/test_events.rb
|
178
|
-
- test/test_config.rb
|
179
177
|
- test/helper.rb
|
180
|
-
- test/test_handle_response.rb
|
181
178
|
- test/test_ssl_verify.rb
|
179
|
+
- test/test_handle_response.rb
|
180
|
+
- test/test_events.rb
|
181
|
+
- test/test_config.rb
|