logstash-output-lmlogs 2.0.2 → 2.0.4

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: a4846f9bbbd52ab6c5f801aa3d6938e7fc58311408588ab3e57adeb12c852b02
4
- data.tar.gz: 23239bd62adc2baf7d8340bcfccf5b63b85bf5b30c189420465f66d3b6584d51
3
+ metadata.gz: d63b3de1ab7597eba97b4712eeb40ceba5f8c3f9efd0f99f0123bd98ee085be0
4
+ data.tar.gz: 2e63421a187f1cdbed504d94caaa421cc00a90790fd52cb44a7b2e9c49ce1a8e
5
5
  SHA512:
6
- metadata.gz: d24e42560a21de68485a601ac2f82e60559269801597756848c4d8d000eace113bc07265e2352f967224f2c43f2abf3f98c47da2855bec8123745429c4e249d8
7
- data.tar.gz: b72a1fb18c3bb21d31c6d78d4291b293c272cea084f761f2359edd9d984b3c01a467bef42c76a7dd3821b590fabebbc2cd3b5a260ba94f3377b6b041a9ca1af0
6
+ metadata.gz: cf6ad8fc04a9c9f05f61547a0d956e9fe54dd92ef9708ca4508751974bc121e6cb9a771a9b292c8499f41bd30e7eaf5a737c34dc6395efdd3f901ca709994fc4
7
+ data.tar.gz: 36ea602ca70119afa88cc8aee70ec4486e4499e14f83068606b22d886614b9581403679370adc4e639f95ed2557fe145661f251d51e2e4c5a84c78d0cb52359c
data/README.md CHANGED
@@ -22,7 +22,8 @@ output {
22
22
  }
23
23
  ```
24
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.domain.com`, portal_name should be set to `test` and portal_domain to `domain.com`
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"]
26
27
 
27
28
 
28
29
 
@@ -115,6 +115,8 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
115
115
  # For developer debugging.
116
116
  @@CONSOLE_LOGS = false
117
117
 
118
+ ALLOWED_DOMAINS = ["logicmonitor.com", "lmgov.us", "qa-lmgov.us"]
119
+
118
120
  public
119
121
  def register
120
122
  @total = 0
@@ -130,6 +132,11 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
130
132
  @portal_domain = "logicmonitor.com"
131
133
  end
132
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
+
133
140
  @final_metadata_keys = Hash.new
134
141
  if @include_metadata_keys.any?
135
142
  include_metadata_keys.each do | nested_key |
@@ -301,6 +308,7 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
301
308
  if @include_metadata
302
309
  lmlogs_event = event_json
303
310
  lmlogs_event.delete("@timestamp") # remove redundant timestamp field
311
+ lmlogs_event["_resource.type"]="Logstash"
304
312
  if lmlogs_event.dig("event", "original") != nil
305
313
  lmlogs_event["event"].delete("original") # remove redundant log field
306
314
  end
@@ -348,4 +356,4 @@ class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
348
356
  documents.push(lmlogs_event)
349
357
  return documents
350
358
  end
351
- end # class LogStash::Outputs::LMLogs
359
+ end # class LogStash::Outputs::LMLogs
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LmLogsLogstashPlugin
4
- VERSION = '2.0.2'
4
+ VERSION = '2.0.4'
5
5
  end
@@ -44,8 +44,7 @@ describe LogStash::Outputs::LMLogs do
44
44
  expected_event = {
45
45
  "message" => "hello this is log 1",
46
46
  "timestamp" => logstash_event.timestamp,
47
- "_lm.resourceId" => {"system.hostname" => "host1"},
48
-
47
+ "_lm.resourceId" => {"system.hostname" => "host1"}
49
48
  }
50
49
  puts " actual : #{constructed_event} \n expected : #{expected_event}"
51
50
 
@@ -77,7 +76,8 @@ describe LogStash::Outputs::LMLogs do
77
76
  "nested" => {"nested2" => {"nested3" => "value",
78
77
  "nested3b" => "value"},
79
78
  "nested_ignored" => "somevalue"
80
- }
79
+ },
80
+ "_resource.type"=>"Logstash"
81
81
  }
82
82
  puts " actual : #{constructed_event} \n expected : #{expected_event}"
83
83
  puts " hash diff : #{Hashdiff.diff(constructed_event,expected_event)}"
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.2
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - LogicMonitor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-25 00:00:00.000000000 Z
11
+ date: 2024-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement