Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lm logs fluentd plugin should not have the account domain hard coded #64

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Create a custom `fluent.conf` or edit the existing one to specify which logs sho
@type lm
resource_mapping {"<event_key>": "<lm_property>"}
company_name <lm_company_name>
company_domain <lm_company_domain>
access_id <lm_access_id>
access_key <lm_access_key>
<buffer>
Expand Down Expand Up @@ -63,6 +64,7 @@ See the [LogicMonitor Helm repository](https://github.com/logicmonitor/k8s-helm-
| Property | Description |
| --- | --- |
| `company_name` | LogicMonitor account name. |
| `company_domain` | LogicMonitor account domain. For eg. for url test.logicmonitor.com, company_domain is logicmonitor. Default is `logicmonitor`. |
| `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>`.|
| `access_id` | LM API Token access ID. |
| `access_key` | LM API Token access key. |
Expand Down
4 changes: 3 additions & 1 deletion lib/fluent/plugin/out_lm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class LmOutput < BufferedOutput

config_param :http_proxy, :string, :default => nil

config_param :company_domain , :string, :default => "logicmonitor"

# Use bearer token for auth.
config_param :bearer_token, :string, :default => nil, secret: true

Expand Down Expand Up @@ -77,7 +79,7 @@ def start
@http_client = Net::HTTP::Persistent.new name: "fluent-plugin-lm-logs", proxy: proxy_uri
@http_client.override_headers["Content-Type"] = "application/json"
@http_client.override_headers["User-Agent"] = log_source + "/" + LmLogsFluentPlugin::VERSION
@url = "https://#{@company_name}.logicmonitor.com/rest/log/ingest"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think logicmonitor.com should come from the variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes line 82 is the change
@url = "https://#{@company_name}.#{@company_domain}.com/rest/log/ingest"

@url = "https://#{@company_name}.#{@company_domain}.com/rest/log/ingest"
@uri = URI.parse(@url)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/plugin/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LmLogsFluentPlugin
VERSION = '1.2.2'
VERSION = '1.2.3'
end
Loading