logstash-output-lmlogs 2.0.1 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0405625445d06fd9ffe883681b4af742c2eb9389bfdcf8390d6d5664bb0ef7b3
4
- data.tar.gz: 4638da227c52b48a5568634cd5336bd183536758a4f764589945d8e52064ca2c
3
+ metadata.gz: 853df620a05762915ead4ebe7e3802dbd56901940dee9bb6c3f2da542d11da17
4
+ data.tar.gz: 31d36f7e4f7713cb64b33f3bb65bf91fb4128837814bfa104193c01700088232
5
5
  SHA512:
6
- metadata.gz: 7470982cfd81c7c519568d8b0d765a7a8a852abd757c72450f63f9f38e2e8fc5687a45c3b0ed3c5f63b9a3d02ffbc7bf7e9f04ec2bd921c2f027e61f7bf98ecc
7
- data.tar.gz: 47e212d3ada1d6263584e1b3f6a7c106ceb96586ecf97fcb1367e5e1e87236579cd30eb7e0ed049e6814fa7b0e650a1d99904613a30e60a7ffdeacb7dfb6af4e
6
+ metadata.gz: fd997c314c4ce6debaeeb56cfcc6ef9a80dbf548b50fa474fd6d465fed3931b74556db5727bda6d0701024e1179910a0ebcba144e71831efc552599212e779db
7
+ data.tar.gz: 85c535050c110631e954ed8b2965e5fa7d5e306bfa15809bc0240db2ab73ed961d5669eb51272b5be894ad7bfb87797f7ed1ad5ebe1e544caa2e6cc598bf8967
data/README.md CHANGED
@@ -15,12 +15,15 @@ Run the following on your Logstash instance
15
15
  output {
16
16
  lmlogs {
17
17
  portal_name => "your company name"
18
+ portal_domain => "your LM company domain."
18
19
  access_id => "your lm access id"
19
20
  access_key => "your access key"
20
21
  }
21
22
  }
22
23
  ```
23
- You would need either `access_id` and `access_id` both or `bearer_token` for authentication with Logicmonitor.
24
+ You would need either `access_id` and `access_id` both or `bearer_token` for authentication with Logicmonitor.
25
+ The portal_domain is the domain of your LM portal. If not set the default is set to `logicmonitor.com`. Eg if your LM portal URL is `https://test.lmgov.us`, portal_name should be set to `test` and portal_domain to `lmgov.us`
26
+ The allowed values for portal_domain are ["logicmonitor.com", "lmgov.us", "qa-lmgov.us"]
24
27
 
25
28
 
26
29
 
@@ -91,9 +91,13 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
91
91
  # LM Portal Name
92
92
  config :portal_name, :validate => :string, :required => true
93
93
 
94
+ # LM Portal Domain. Default will be logicmonitor.com
95
+ config :portal_domain, :validate => :string, :required => false, :default => "logicmonitor.com"
96
+
94
97
  # Username to use for HTTP auth.
95
98
  config :access_id, :validate => :string, :required => false, :default => nil
96
99
 
100
+
97
101
  # Include/Exclude metadata from sending to LM Logs
98
102
  config :include_metadata, :validate => :boolean, :default => false
99
103
 
@@ -111,6 +115,8 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
111
115
  # For developer debugging.
112
116
  @@CONSOLE_LOGS = false
113
117
 
118
+ ALLOWED_DOMAINS = ["logicmonitor.com", "lmgov.us", "qa-lmgov.us"]
119
+
114
120
  public
115
121
  def register
116
122
  @total = 0
@@ -121,6 +127,16 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
121
127
  :size => @@MAX_PAYLOAD_SIZE)
122
128
  configure_auth
123
129
 
130
+ # Check if `portal_domain` is an empty string and set the default value
131
+ if @portal_domain.nil? || @portal_domain.strip.empty?
132
+ @portal_domain = "logicmonitor.com"
133
+ end
134
+
135
+ unless ALLOWED_DOMAINS.include?(@portal_domain)
136
+ raise LogStash::ConfigurationError, "Invalid portal_domain: #{@portal_domain}. Allowed values are: #{ALLOWED_DOMAINS.join(', ')}"
137
+ end
138
+ log_debug("Setting LM portal domain ", :portal_domain => portal_domain)
139
+
124
140
  @final_metadata_keys = Hash.new
125
141
  if @include_metadata_keys.any?
126
142
  include_metadata_keys.each do | nested_key |
@@ -201,7 +217,7 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
201
217
  def send_batch(events)
202
218
  log_debug("Started sending logs to LM: ",
203
219
  :time => Time::now.utc)
204
- url = "https://" + @portal_name + ".logicmonitor.com/rest/log/ingest"
220
+ url = "https://" + @portal_name + "." + @portal_domain +"/rest/log/ingest"
205
221
  body = events.to_json
206
222
  auth_string = generate_auth_string(body)
207
223
  request = client.post(url, {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LmLogsLogstashPlugin
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-lmlogs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - LogicMonitor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement