logstash-output-azure_service_bus 0.1.5 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d1ab85ffd5040b91fbe44ed966e44d14b56b7f67e601bacad8728df74d3b79c
4
- data.tar.gz: c09bf977588ee59480e675e408319f5ba8e522760b2d4fa78f23ca6134e6ae27
3
+ metadata.gz: af1daf5ab0f287bfe29993a09437eb840063c5195d5dc9c247985fae757a09bd
4
+ data.tar.gz: afb35cc44123159129fc63fe5fcb374c7cb77ac98137b3b2ae0e513e96b12f09
5
5
  SHA512:
6
- metadata.gz: c0423f46cc7f83c93c8ff4c1cbdc334d113f3d711955528cca585ffe41269d193f6c59a151a49e4398a9779b55f0de03831c00a5423ca3f3353e76e194558347
7
- data.tar.gz: 41dd6bf7c6b813ebf3c88a6e1e61c565d200a64b0e78c0ad6d90f68a3115b44c526a1baedde37fdad568c4d10934c9e3698862048c1d2bc9a46152cfbad3e515
6
+ metadata.gz: 3727d297acacbee56d2570ac67aca3e05bcc2f677b6ab5ab50c3acfa84aa721c683be70810fdcc26203124d615cbd99e6bb19fc5f1d68d3eccefd859e288d0e9
7
+ data.tar.gz: a72b4442be6118a0b933b2d3e9b6736a282e3024f32f00dd9bb4506b6096c02a824777ebe7535340d53eb9c152121b8e9bf2bf70c00d9d5b05b9ccb67307306e
data/README.md CHANGED
@@ -22,6 +22,22 @@ output {
22
22
  }
23
23
  }
24
24
  ```
25
+ There is one optional setting (`messageid_field`) which sets the Service Bus `MessageId` value to an existing, unique field. If this setting is not used, Service Bus will generate an id when the message is created. The value of the provided field _must_ be unique or Service Bus will reject the message. A sample config might look like:
26
+ ```
27
+ input { ... }
28
+ filter {
29
+ uuid {
30
+ target => "uuid"
31
+ }
32
+ }
33
+ output {
34
+ azure_service_bus {
35
+ service_bus_namespace => "service-bus-name"
36
+ service_bus_entity => "queue-or-topic-name"
37
+ messageid_field => "uuid"
38
+ }
39
+ }
40
+ ```
25
41
 
26
42
  ## Service Bus Configuration
27
43
  This plugin will retry sending messages if the Service Bus connection times out or returns a bad response. To avoid idempotence issues, you should enable duplicate detection on the destination queue or topic.
@@ -10,6 +10,7 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
10
10
 
11
11
  config :service_bus_namespace, :validate => :string, :required => true
12
12
  config :service_bus_entity, :validate => :string, :required => true
13
+ config :messageid_field, :validate => :string
13
14
 
14
15
  def register
15
16
  retry_options = {
@@ -20,13 +21,13 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
20
21
  retry_statuses: [429, 500],
21
22
  exceptions: [Faraday::ConnectionFailed, Faraday::TimeoutError, Faraday::RetriableResponse],
22
23
  methods: %i[get post],
23
- retry_block: ->(_env, _options, retries, exception) { @logger.error("Error (#{exception}) for #{env.method.upcase} #{env.url} - #{retries + 1} retry(s) left") }
24
+ retry_block: ->(env, _options, retries, exception) { @logger.warn("Error (#{exception}) for #{env.method.upcase} #{env.url} - #{retries + 1} retry(s) left") }
24
25
  }
25
26
  @token_conn = Faraday.new(
26
27
  url: 'http://169.254.169.254/metadata/identity/oauth2/token',
27
28
  params: { 'api-version' => '2018-02-01', 'resource' => 'https://servicebus.azure.net/' },
28
29
  headers: { 'Metadata' => 'true' },
29
- request: { timeout: 1 }
30
+ request: { timeout: 4 }
30
31
  ) do |f|
31
32
  f.request :retry, retry_options
32
33
  end
@@ -48,7 +49,11 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
48
49
  def send_events(events)
49
50
  messages = []
50
51
  events.each do |event|
51
- messages.append({ 'Body' => JSON.generate(event.to_hash), 'BrokerProperties' => { 'ContentType' => 'application/json' } })
52
+ if @messageid_field.nil?
53
+ messages.append({ 'Body' => JSON.generate(event.to_hash), 'BrokerProperties' => { 'ContentType' => 'application/json' } })
54
+ else
55
+ messages.append({ 'Body' => JSON.generate(event.to_hash), 'BrokerProperties' => { 'ContentType' => 'application/json', 'MessageId' => event.get(@messageid_field) } })
56
+ end
52
57
  end
53
58
  post_messages(messages)
54
59
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-azure_service_bus'
3
- s.version = '0.1.5'
3
+ s.version = '0.2.1'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Send Logstash messages to Azure Service Bus.'
6
6
  s.homepage = 'https://github.com/gharryg/logstash-output-azure_service_bus'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-azure_service_bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harrison Golden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement