fluent-plugin-lm-logs 1.2.0 → 1.2.3

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: 9029af24ba774f88379606844f5faabf062c5bfe4df7f47386dccd72ceb62217
4
- data.tar.gz: e2418db14714305e3cec4103255d9ee86a28b2abfdecceb35ec2976b0b78858d
3
+ metadata.gz: b0760c2ab48870f18a21e0fe7de74686f71ab108936850c68d61eb6d87d614d8
4
+ data.tar.gz: a26aaf13e4a5caf38add3d592927f94127a962fba8be340e6f42aef904992a6a
5
5
  SHA512:
6
- metadata.gz: f63f0f6a27956cbd08bc8272fcbaebd50f93fd2338b4f17ea9480f2ab35579b86078a8d422476e235dbf6c8e3e014c022158bca72ce6e621399f6d724db95ed0
7
- data.tar.gz: 3abdc791dceb1d87407004537ad6f4ec1e40bf730aea9680f4124846d6eb506c9e14817a57a7da8c26af2b01894a9f8353489ad2d6ecfbf6297972f93a028f84
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
@@ -3,5 +3,6 @@ require "rake/testtask"
3
3
  task default: "test"
4
4
 
5
5
  Rake::TestTask.new do |task|
6
- task.pattern = "test/plugin/*.rb"
7
- end
6
+ task.libs << "test"
7
+ task.test_files = Dir.glob('test/plugin/*.rb') - ['test/plugin/test_performance.rb']
8
+ end
@@ -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}.logicmonitor.com/rest/log/ingest"
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 == nil || @access_key == nil
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 == nil
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LmLogsFluentPlugin
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.3'
5
5
  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.0
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: 2023-09-21 00:00:00.000000000 Z
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.4.10
83
+ rubygems_version: 3.5.16
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: LogicMonitor logs fluentd output plugin