Skip to content

Commit d27966f

Browse files
committed
Add user agent as lm-logs-logstash/{plugin-version}.
1 parent a45206d commit d27966f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

lib/logstash/outputs/lmlogs.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
require 'base64'
99
require 'openssl'
1010
require 'manticore'
11+
require_relative "version"
1112

1213
# An example output that does nothing.
1314
class LogStash::Outputs::LMLogs < LogStash::Outputs::Base
@@ -164,12 +165,12 @@ def configure_auth
164165
if @access_id == nil || @access_key.value == nil
165166
@logger.info "Access Id or access key null. Using bearer token for authentication."
166167
@use_bearer_instead_of_lmv1 = true
167-
end
168-
if @use_bearer_instead_of_lmv1 && @bearer_token.value == nil
168+
end
169+
if @use_bearer_instead_of_lmv1 && @bearer_token.value == nil
169170
@logger.error "Bearer token not specified. Either access_id and access_key both or bearer_token must be specified for authentication with Logicmonitor."
170171
raise LogStash::ConfigurationError, 'No valid authentication specified. Either access_id and access_key both or bearer_token must be specified for authentication with Logicmonitor.'
171172
end
172-
end
173+
end
173174
def generate_auth_string(body)
174175
if @use_bearer_instead_of_lmv1
175176
return "Bearer #{@bearer_token.value}"
@@ -196,7 +197,7 @@ def send_batch(events)
196197
:body => body,
197198
:headers => {
198199
"Content-Type" => "application/json",
199-
"User-Agent" => "LM Logs Logstash Plugin",
200+
"User-Agent" => "lm-logs-logstash/" + LmLogsLogstashPlugin::VERSION,
200201
"Authorization" => "#{auth_string}"
201202
}
202203
})

lib/logstash/outputs/version.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
module LmLogsLogstashPlugin
4+
VERSION = '1.3.1'
5+
end

logstash-output-lmlogs.gemspec

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
5+
require "logstash/outputs/version.rb"
6+
7+
8+
19
Gem::Specification.new do |s|
210
s.name = 'logstash-output-lmlogs'
3-
s.version = '1.3.0'
11+
s.version = LmLogsLogstashPlugin::VERSION
412
s.licenses = ['Apache-2.0']
513
s.summary = "Logstash output plugin for LM Logs"
614
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"

0 commit comments

Comments
 (0)