Skip to content

Commit 88aa53d

Browse files
Merge pull request #16 from logicmonitor/Add_domain_support_for_govcloud
Add domain support for govcloud
2 parents 862e0c3 + f2e892a commit 88aa53d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ Run the following on your Logstash instance
1515
output {
1616
lmlogs {
1717
portal_name => "your company name"
18+
portal_domain => "your LM company domain."
1819
access_id => "your lm access id"
1920
access_key => "your access key"
2021
}
2122
}
2223
```
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.domain.com`, portal_name should be set to `test` and portal_domain to `domain.com`
2426

2527

2628

lib/logstash/outputs/lmlogs.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ class InvalidHTTPConfigError < StandardError; end
9191
# LM Portal Name
9292
config :portal_name, :validate => :string, :required => true
9393

94+
# LM Portal Domain. Default will be logicmonitor.com
95+
config :portal_domain, :validate => :string, :required => false, :default => "logicmonitor.com"
96+
9497
# Username to use for HTTP auth.
9598
config :access_id, :validate => :string, :required => false, :default => nil
9699

100+
97101
# Include/Exclude metadata from sending to LM Logs
98102
config :include_metadata, :validate => :boolean, :default => false
99103

@@ -121,6 +125,11 @@ def register
121125
:size => @@MAX_PAYLOAD_SIZE)
122126
configure_auth
123127

128+
# Check if `portal_domain` is an empty string and set the default value
129+
if @portal_domain.nil? || @portal_domain.strip.empty?
130+
@portal_domain = "logicmonitor.com"
131+
end
132+
124133
@final_metadata_keys = Hash.new
125134
if @include_metadata_keys.any?
126135
include_metadata_keys.each do | nested_key |
@@ -201,7 +210,7 @@ def generate_auth_string(body)
201210
def send_batch(events)
202211
log_debug("Started sending logs to LM: ",
203212
:time => Time::now.utc)
204-
url = "https://" + @portal_name + ".logicmonitor.com/rest/log/ingest"
213+
url = "https://" + @portal_name + "." + @portal_domain +"/rest/log/ingest"
205214
body = events.to_json
206215
auth_string = generate_auth_string(body)
207216
request = client.post(url, {

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.1'
4+
VERSION = '2.0.2'
55
end

0 commit comments

Comments
 (0)