Skip to content

Commit 4fa6501

Browse files
Merge pull request #17 from logicmonitor/Add_domain_support_for_govcloud
Adding restriction/validation on the allowed domains for LM portal
2 parents 88aa53d + 59111ba commit 4fa6501

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ output {
2222
}
2323
```
2424
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"]
2627

2728

2829

lib/logstash/outputs/lmlogs.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class InvalidHTTPConfigError < StandardError; end
115115
# For developer debugging.
116116
@@CONSOLE_LOGS = false
117117

118+
ALLOWED_DOMAINS = ["logicmonitor.com", "lmgov.us", "qa-lmgov.us"]
119+
118120
public
119121
def register
120122
@total = 0
@@ -130,6 +132,11 @@ def register
130132
@portal_domain = "logicmonitor.com"
131133
end
132134

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+
133140
@final_metadata_keys = Hash.new
134141
if @include_metadata_keys.any?
135142
include_metadata_keys.each do | nested_key |

lib/logstash/outputs/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module LmLogsLogstashPlugin
4-
VERSION = '2.0.2'
4+
VERSION = '2.0.3'
55
end

0 commit comments

Comments
 (0)