logstash-mixin-rabbitmq_connection 4.1.3-java → 4.2.0-java

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
  SHA1:
3
- metadata.gz: 2ea336ab01162c3e3d4c52b822b3f843e857b5b9
4
- data.tar.gz: 68df566879f34bcd6eef31590cb4ec5a982f20f4
3
+ metadata.gz: d69c8668720b7ebda212adced29bc3d12e49f574
4
+ data.tar.gz: 132c42eb041488be8e104ed56eb1768c95129b37
5
5
  SHA512:
6
- metadata.gz: b5863c4c931266e1a7fa1f770236b82c714a943400e53da7242bb1e1761f6dc2920a14590eba8fbf88123f65c9570fd8ab868b9f4cc597dc4788e894eb7fca51
7
- data.tar.gz: 1b9e2e6a31028ea37f6daa169384a6a572ac9dc3a0142e1fd7b3abee3ee36400c522b363ebc06ac1aabc2081810f41982a7ef995bcd99a2572e7d448f51978c1
6
+ metadata.gz: cc00581244fe0d5be9fd812d02ba202169fa90da128d2e70a4648994cfd55a74b13e2075e89fa2e2968f84a012925ffff7a01b37ccf1cc5dd926337c104fff6a
7
+ data.tar.gz: 15328dfa0dfbbc23fd7e6a0aa062abd2cd61bbd6c59a00e2e279fa8a66df42aceeb57b624ce8aed17b939435d5dcc421728e741e625bd94278186d26eacc10c8
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ * 4.2.0
2
+ - Include URL of server when logging errors
3
+ - Add warning log when connection is severed
1
4
  * 4.1.3
2
5
  - Bump march_hare version to 2.19.0 to fix reconnection failures with
3
6
  proxies. See
@@ -18,7 +18,7 @@ module LogStash
18
18
  end
19
19
 
20
20
  def setup_rabbitmq_connection_config
21
- # RabbitMQ server address(es)
21
+ # RabbitMQ server address(es)
22
22
  # host can either be a single host, or a list of hosts
23
23
  # i.e.
24
24
  # host => "localhost"
@@ -201,9 +201,19 @@ module LogStash
201
201
 
202
202
  connection = MarchHare.connect(rabbitmq_settings)
203
203
 
204
-
205
- connection.on_blocked { @logger.warn("RabbitMQ output blocked! Check your RabbitMQ instance!") }
206
- connection.on_unblocked { @logger.warn("RabbitMQ output unblocked!") }
204
+ connection.on_shutdown do |conn, cause|
205
+ @logger.warn("RabbitMQ connection was closed!",
206
+ :url => connection_url(conn),
207
+ :automatic_recovery => @automatic_recovery,
208
+ :cause => cause)
209
+ end
210
+ connection.on_blocked do
211
+ @logger.warn("RabbitMQ connection blocked! Check your RabbitMQ instance!",
212
+ :url => connection_url(connection))
213
+ end
214
+ connection.on_unblocked do
215
+ @logger.warn("RabbitMQ connection unblocked!", :url => connection_url(connection))
216
+ end
207
217
 
208
218
  channel = connection.create_channel
209
219
  @logger.info("Connected to RabbitMQ at #{rabbitmq_settings[:host]}")
@@ -211,6 +221,13 @@ module LogStash
211
221
  HareInfo.new(connection, channel)
212
222
  end
213
223
 
224
+ # Mostly used for printing debug logs
225
+ def connection_url(connection)
226
+ user_pass = connection.user ? "#{connection.user}:XXXXXX@" : ""
227
+ protocol = params["ssl"] ? "amqps" : "amqp"
228
+ "#{protocol}://#{user_pass}#{connection.host}:#{connection.port}#{connection.vhost}"
229
+ end
230
+
214
231
  def sleep_for_retry
215
232
  Stud.stoppable_sleep(@connect_retry_interval) { @rabbitmq_connection_stopping }
216
233
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'logstash-mixin-rabbitmq_connection'
4
- s.version = '4.1.3'
4
+ s.version = '4.2.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Common functionality for RabbitMQ plugins"
7
7
  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"
@@ -96,6 +96,7 @@ describe LogStash::PluginMixins::RabbitMQConnection do
96
96
  allow(connection).to receive(:create_channel).and_return(channel)
97
97
  allow(connection).to receive(:on_blocked)
98
98
  allow(connection).to receive(:on_unblocked)
99
+ allow(connection).to receive(:on_shutdown)
99
100
 
100
101
  instance.register
101
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-mixin-rabbitmq_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.3
4
+ version: 4.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic