fluent-plugin-lm-logs 1.2.0 → 1.2.3
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 +2 -0
- data/Rakefile +3 -2
- data/lib/fluent/plugin/out_lm.rb +15 -4
- data/lib/fluent/plugin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0760c2ab48870f18a21e0fe7de74686f71ab108936850c68d61eb6d87d614d8
|
4
|
+
data.tar.gz: a26aaf13e4a5caf38add3d592927f94127a962fba8be340e6f42aef904992a6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a48d16e49022f749a51fb908903a68c360001524867d73887b9296e78d67061cff935207542e594b963bafbe60bb47b528e0a807dbaba2433b477132f8c512a9
|
7
|
+
data.tar.gz: 01ee33b6e727f85af1b755915402f71888344c3f75a8692a23f4a7593af04789bfa441fab057585eb30052025b6a43f80d9d5c76b1e493f9d99f8470fa03e9b4
|
data/README.md
CHANGED
@@ -22,6 +22,7 @@ Create a custom `fluent.conf` or edit the existing one to specify which logs sho
|
|
22
22
|
@type lm
|
23
23
|
resource_mapping {"<event_key>": "<lm_property>"}
|
24
24
|
company_name <lm_company_name>
|
25
|
+
company_domain <lm_company_domain>
|
25
26
|
access_id <lm_access_id>
|
26
27
|
access_key <lm_access_key>
|
27
28
|
<buffer>
|
@@ -63,6 +64,7 @@ See the [LogicMonitor Helm repository](https://github.com/logicmonitor/k8s-helm-
|
|
63
64
|
| Property | Description |
|
64
65
|
| --- | --- |
|
65
66
|
| `company_name` | LogicMonitor account name. |
|
67
|
+
| `company_domain` | LogicMonitor account domain. For eg. for url test.logicmonitor.com, company_domain is logicmonitor.com . Default is `logicmonitor.com`. |
|
66
68
|
| `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
69
|
| `access_id` | LM API Token access ID. |
|
68
70
|
| `access_key` | LM API Token access key. |
|
data/Rakefile
CHANGED
data/lib/fluent/plugin/out_lm.rb
CHANGED
@@ -49,6 +49,8 @@ module Fluent
|
|
49
49
|
|
50
50
|
config_param :http_proxy, :string, :default => nil
|
51
51
|
|
52
|
+
config_param :company_domain , :string, :default => "logicmonitor.com"
|
53
|
+
|
52
54
|
# Use bearer token for auth.
|
53
55
|
config_param :bearer_token, :string, :default => nil, secret: true
|
54
56
|
|
@@ -77,17 +79,17 @@ module Fluent
|
|
77
79
|
@http_client = Net::HTTP::Persistent.new name: "fluent-plugin-lm-logs", proxy: proxy_uri
|
78
80
|
@http_client.override_headers["Content-Type"] = "application/json"
|
79
81
|
@http_client.override_headers["User-Agent"] = log_source + "/" + LmLogsFluentPlugin::VERSION
|
80
|
-
@url = "https://#{@company_name}
|
82
|
+
@url = "https://#{@company_name}.#{@company_domain}/rest/log/ingest"
|
81
83
|
@uri = URI.parse(@url)
|
82
84
|
end
|
83
85
|
|
84
86
|
def configure_auth
|
85
87
|
@use_bearer_instead_of_lmv1 = false
|
86
|
-
if @access_id
|
87
|
-
log.info "Access Id or access key null. Using bearer token for authentication."
|
88
|
+
if is_blank(@access_id) || is_blank(@access_key)
|
89
|
+
log.info "Access Id or access key blank / null. Using bearer token for authentication."
|
88
90
|
@use_bearer_instead_of_lmv1 = true
|
89
91
|
end
|
90
|
-
if @use_bearer_instead_of_lmv1 && @bearer_token
|
92
|
+
if @use_bearer_instead_of_lmv1 && is_blank(@bearer_token)
|
91
93
|
log.error "Bearer token not specified. Either access_id and access_key both or bearer_token must be specified for authentication with Logicmonitor."
|
92
94
|
raise ArgumentError, 'No valid authentication specified. Either access_id and access_key both or bearer_token must be specified for authentication with Logicmonitor.'
|
93
95
|
end
|
@@ -244,5 +246,14 @@ module Fluent
|
|
244
246
|
return "LMv1 #{@access_id}:#{signature}:#{timestamp}"
|
245
247
|
end
|
246
248
|
end
|
249
|
+
|
250
|
+
def is_blank(str)
|
251
|
+
if str.nil? || str.to_s.strip.empty?
|
252
|
+
return true
|
253
|
+
else
|
254
|
+
return false
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
247
258
|
end
|
248
259
|
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.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LogicMonitor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.5.16
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: LogicMonitor logs fluentd output plugin
|