fluent-plugin-lm-logs 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/fluent/plugin/out_lm.rb +17 -13
- data/lib/fluent/plugin/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9029af24ba774f88379606844f5faabf062c5bfe4df7f47386dccd72ceb62217
|
4
|
+
data.tar.gz: e2418db14714305e3cec4103255d9ee86a28b2abfdecceb35ec2976b0b78858d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f63f0f6a27956cbd08bc8272fcbaebd50f93fd2338b4f17ea9480f2ab35579b86078a8d422476e235dbf6c8e3e014c022158bca72ce6e621399f6d724db95ed0
|
7
|
+
data.tar.gz: 3abdc791dceb1d87407004537ad6f4ec1e40bf730aea9680f4124846d6eb506c9e14817a57a7da8c26af2b01894a9f8353489ad2d6ecfbf6297972f93a028f84
|
data/README.md
CHANGED
@@ -66,6 +66,7 @@ See the [LogicMonitor Helm repository](https://github.com/logicmonitor/k8s-helm-
|
|
66
66
|
| `resource_mapping` | The mapping that defines the source of the log event to the LM resource. In this case, the `<event_key>` in the incoming event is mapped to the value of `<lm_property>`.|
|
67
67
|
| `access_id` | LM API Token access ID. |
|
68
68
|
| `access_key` | LM API Token access key. |
|
69
|
+
| `bearer_token` | LM API Bearer Token. Either specify `access_id` and `access_key` both or `bearer_token`. If all specified, LMv1 token(`access_id` and `access_key`) will be used for authentication with Logicmonitor. |
|
69
70
|
| `flush_interval` | Defines the time in seconds to wait before sending batches of logs to LogicMonitor. Default is `60s`. |
|
70
71
|
| `debug` | When `true`, logs more information to the fluentd console. |
|
71
72
|
| `force_encoding` | Specify charset when logs contains invalid utf-8 characters. |
|
data/lib/fluent/plugin/out_lm.rb
CHANGED
@@ -36,7 +36,7 @@ module Fluent
|
|
36
36
|
config_param :debug, :bool, :default => false
|
37
37
|
|
38
38
|
config_param :include_metadata, :bool, :default => false
|
39
|
-
|
39
|
+
|
40
40
|
config_param :force_encoding, :string, :default => ""
|
41
41
|
|
42
42
|
config_param :compression, :string, :default => ""
|
@@ -48,7 +48,7 @@ module Fluent
|
|
48
48
|
config_param :device_less_logs, :bool, :default => false
|
49
49
|
|
50
50
|
config_param :http_proxy, :string, :default => nil
|
51
|
-
|
51
|
+
|
52
52
|
# Use bearer token for auth.
|
53
53
|
config_param :bearer_token, :string, :default => nil, secret: true
|
54
54
|
|
@@ -59,6 +59,10 @@ module Fluent
|
|
59
59
|
super
|
60
60
|
end
|
61
61
|
|
62
|
+
def multi_workers_ready?
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
62
66
|
# This method is called when starting.
|
63
67
|
# Open sockets or files here.
|
64
68
|
def start
|
@@ -82,8 +86,8 @@ module Fluent
|
|
82
86
|
if @access_id == nil || @access_key == nil
|
83
87
|
log.info "Access Id or access key null. Using bearer token for authentication."
|
84
88
|
@use_bearer_instead_of_lmv1 = true
|
85
|
-
end
|
86
|
-
if @use_bearer_instead_of_lmv1 && @bearer_token == nil
|
89
|
+
end
|
90
|
+
if @use_bearer_instead_of_lmv1 && @bearer_token == nil
|
87
91
|
log.error "Bearer token not specified. Either access_id and access_key both or bearer_token must be specified for authentication with Logicmonitor."
|
88
92
|
raise ArgumentError, 'No valid authentication specified. Either access_id and access_key both or bearer_token must be specified for authentication with Logicmonitor.'
|
89
93
|
end
|
@@ -150,7 +154,7 @@ module Fluent
|
|
150
154
|
else
|
151
155
|
lm_event[DEVICELESS_KEY_SERVICE] = encode_if_necessary(record[DEVICELESS_KEY_SERVICE])
|
152
156
|
if record[DEVICELESS_KEY_NAMESPACE]!=nil
|
153
|
-
lm_event[DEVICELESS_KEY_NAMESPACE] = encode_if_necessary(record[DEVICELESS_KEY_NAMESPACE])
|
157
|
+
lm_event[DEVICELESS_KEY_NAMESPACE] = encode_if_necessary(record[DEVICELESS_KEY_NAMESPACE])
|
154
158
|
end
|
155
159
|
end
|
156
160
|
end
|
@@ -167,13 +171,13 @@ module Fluent
|
|
167
171
|
end
|
168
172
|
|
169
173
|
def get_metadata(record)
|
170
|
-
#if encoding is not defined we will skip going through each key val
|
174
|
+
#if encoding is not defined we will skip going through each key val
|
171
175
|
#and return the whole record for performance reasons in case of a bulky record.
|
172
|
-
if @force_encoding == ""
|
176
|
+
if @force_encoding == ""
|
173
177
|
return record
|
174
178
|
else
|
175
179
|
lm_event = {}
|
176
|
-
record.each do |key, value|
|
180
|
+
record.each do |key, value|
|
177
181
|
lm_event["#{key}"] = get_encoded_string(value)
|
178
182
|
end
|
179
183
|
return lm_event
|
@@ -194,7 +198,7 @@ module Fluent
|
|
194
198
|
|
195
199
|
def send_batch(events)
|
196
200
|
body = events.to_json
|
197
|
-
|
201
|
+
|
198
202
|
if @debug
|
199
203
|
log.info "Sending #{events.length} events to logic monitor at #{@url}"
|
200
204
|
log.info "Request json #{body}"
|
@@ -218,7 +222,7 @@ module Fluent
|
|
218
222
|
end
|
219
223
|
|
220
224
|
resp = @http_client.request @uri, request
|
221
|
-
if @debug || resp.kind_of?(Net::HTTPMultiStatus) || !resp.kind_of?(Net::HTTPSuccess)
|
225
|
+
if @debug || resp.kind_of?(Net::HTTPMultiStatus) || !resp.kind_of?(Net::HTTPSuccess)
|
222
226
|
log.info "Status code:#{resp.code} Request Id:#{resp.header['x-request-id']} message:#{resp.body}"
|
223
227
|
end
|
224
228
|
end
|
@@ -228,7 +232,7 @@ module Fluent
|
|
228
232
|
|
229
233
|
if @use_bearer_instead_of_lmv1
|
230
234
|
return "Bearer #{@bearer_token}"
|
231
|
-
else
|
235
|
+
else
|
232
236
|
timestamp = DateTime.now.strftime('%Q')
|
233
237
|
signature = Base64.strict_encode64(
|
234
238
|
OpenSSL::HMAC.hexdigest(
|
@@ -238,7 +242,7 @@ module Fluent
|
|
238
242
|
)
|
239
243
|
)
|
240
244
|
return "LMv1 #{@access_id}:#{signature}:#{timestamp}"
|
241
|
-
end
|
245
|
+
end
|
242
246
|
end
|
243
247
|
end
|
244
|
-
end
|
248
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-lm-logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LogicMonitor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|