logstash-output-azure_service_bus 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af1daf5ab0f287bfe29993a09437eb840063c5195d5dc9c247985fae757a09bd
4
- data.tar.gz: afb35cc44123159129fc63fe5fcb374c7cb77ac98137b3b2ae0e513e96b12f09
3
+ metadata.gz: d92fdd5d7f0480de294337224352219cbf9d3d716f52af0ab4e80ce9a15cda76
4
+ data.tar.gz: f71204c35cdb3ec8d8366e21c2a6704e267d2385084e40e55786f3159bb885f0
5
5
  SHA512:
6
- metadata.gz: 3727d297acacbee56d2570ac67aca3e05bcc2f677b6ab5ab50c3acfa84aa721c683be70810fdcc26203124d615cbd99e6bb19fc5f1d68d3eccefd859e288d0e9
7
- data.tar.gz: a72b4442be6118a0b933b2d3e9b6736a282e3024f32f00dd9bb4506b6096c02a824777ebe7535340d53eb9c152121b8e9bf2bf70c00d9d5b05b9ccb67307306e
6
+ metadata.gz: cb50873e64d439fc6114e748c9fd86c53b70b6d7ca3ca3eb271c71950941ccaa92fc2927259e8143c2349bd32b2f56313ec1a257dc3bfc01a07afcfc55375efb
7
+ data.tar.gz: 5fd4b7d91de58c9e439cbf39f4d935a6f688b149ace2b0135743f3a1ed6684951828689066a73f447fa8a15f928cdd3c0affa1b02e9a5f5920b31edf9f6dd0e5
data/README.md CHANGED
@@ -7,7 +7,7 @@ This plugin is hosted on RubyGems.org: [https://rubygems.org/gems/logstash-outpu
7
7
  ## Install
8
8
  To install, use the plugin tool that is part of your Logstash installation:
9
9
  ```
10
- $LOGSTASH_INSTALL/bin/logstash-plugin install logstash-output-azure_service_bus
10
+ $LOGSTASH_PATH/bin/logstash-plugin install logstash-output-azure_service_bus
11
11
  ```
12
12
 
13
13
  ## Pipeline Configuration
@@ -27,14 +27,18 @@ There is one optional setting (`messageid_field`) which sets the Service Bus `Me
27
27
  input { ... }
28
28
  filter {
29
29
  uuid {
30
- target => "uuid"
30
+ target => "[@metadata][uuid]"
31
31
  }
32
32
  }
33
33
  output {
34
34
  azure_service_bus {
35
35
  service_bus_namespace => "service-bus-name"
36
36
  service_bus_entity => "queue-or-topic-name"
37
- messageid_field => "uuid"
37
+ messageid_field => "[@metadata][uuid]"
38
+ }
39
+ elasticsearch {
40
+ ...
41
+ document_id => "%{[@metadata][uuid]}"
38
42
  }
39
43
  }
40
44
  ```
@@ -14,14 +14,14 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
14
14
 
15
15
  def register
16
16
  retry_options = {
17
- max: 3,
17
+ max: 5,
18
18
  interval: 1,
19
19
  interval_randomness: 0.5,
20
20
  backoff_factor: 2,
21
21
  retry_statuses: [429, 500],
22
22
  exceptions: [Faraday::ConnectionFailed, Faraday::TimeoutError, Faraday::RetriableResponse],
23
23
  methods: %i[get post],
24
- retry_block: ->(env, _options, retries, exception) { @logger.warn("Error (#{exception}) for #{env.method.upcase} #{env.url} - #{retries + 1} retry(s) left") }
24
+ retry_block: ->(env, _options, retries, exception) { @logger.warn("Problem (#{exception}) for #{env.method.upcase} #{env.url} - #{retries + 1} retry(s) left") }
25
25
  }
26
26
  @token_conn = Faraday.new(
27
27
  url: 'http://169.254.169.254/metadata/identity/oauth2/token',
@@ -60,11 +60,15 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
60
60
 
61
61
  def post_messages(messages)
62
62
  refresh_access_token if access_token_needs_refresh?
63
- response = @service_bus_conn.post('messages') do |req|
64
- req.body = JSON.generate(messages)
65
- req.headers = { 'Authorization' => "Bearer #{@access_token}", 'Content-Type' => 'application/vnd.microsoft.servicebus.json' }
63
+ begin
64
+ response = @service_bus_conn.post('messages') do |req|
65
+ req.body = JSON.generate(messages)
66
+ req.headers = { 'Authorization' => "Bearer #{@access_token}", 'Content-Type' => 'application/vnd.microsoft.servicebus.json' }
67
+ end
68
+ rescue StandardError => e
69
+ @logger.error("Error (#{e}) while sending message to Service Bus")
66
70
  end
67
- raise "Error while sending message to Service Bus: HTTP #{response.status}" if response.status != 201
71
+ @logger.error("HTTP error while sending message to Service Bus: HTTP #{response.status}") if response.status != 201
68
72
 
69
73
  @logger.debug("Sent #{messages.length} message(s) to Service Bus")
70
74
  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.2.1'
3
+ s.version = '0.2.2'
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.2.1
4
+ version: 0.2.2
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-06 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement