logstash-output-rabbitmq 4.0.8-java → 4.0.9-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/index.asciidoc +15 -1
- data/lib/logstash/outputs/rabbitmq.rb +7 -1
- data/logstash-output-rabbitmq.gemspec +1 -1
- data/spec/outputs/rabbitmq_spec.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81301ba88af89e3b1427938cdc9ea122ffcc433b
|
4
|
+
data.tar.gz: 37d9e3da7d885219467fba9744466c416e3b623f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 436b3e2a85d24d3914729f47f38801af784412e866180d8cfb6b63ed6c202d78512b25dfb641731b18e71f603cb3a5b6fce768be6bd93e797f6a55998f0e8205
|
7
|
+
data.tar.gz: b2c9fa6978873f832f59358cbfb8408c787992c8367ae8883ecd1d9dc9b0877357ca3c4d456639138ed55eef201c659867f599e280217a5c096ca3625c8b607e
|
data/CHANGELOG.md
CHANGED
data/docs/index.asciidoc
CHANGED
@@ -12,7 +12,7 @@ START - GENERATED VARIABLES, DO NOT EDIT!
|
|
12
12
|
END - GENERATED VARIABLES, DO NOT EDIT!
|
13
13
|
///////////////////////////////////////////
|
14
14
|
|
15
|
-
[id="plugins-{type}-{plugin}"]
|
15
|
+
[id="plugins-{type}s-{plugin}"]
|
16
16
|
|
17
17
|
=== Rabbitmq output plugin
|
18
18
|
|
@@ -46,6 +46,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
46
46
|
| <<plugins-{type}s-{plugin}-heartbeat>> |<<number,number>>|No
|
47
47
|
| <<plugins-{type}s-{plugin}-host>> |<<string,string>>|Yes
|
48
48
|
| <<plugins-{type}s-{plugin}-key>> |<<string,string>>|No
|
49
|
+
| <<plugins-{type}s-{plugin}-message_properties>> |<<Hash,Hash>>|No
|
49
50
|
| <<plugins-{type}s-{plugin}-passive>> |<<boolean,boolean>>|No
|
50
51
|
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
|
51
52
|
| <<plugins-{type}s-{plugin}-persistent>> |<<boolean,boolean>>|No
|
@@ -169,6 +170,19 @@ Key to route to by default. Defaults to 'logstash'
|
|
169
170
|
|
170
171
|
* Routing keys are ignored on fanout exchanges.
|
171
172
|
|
173
|
+
[id="plugins-{type}s-{plugin}-message_properties"]
|
174
|
+
===== `message_properties`
|
175
|
+
|
176
|
+
* Value type is <<hash,hash>>
|
177
|
+
* Default value is `{}`
|
178
|
+
|
179
|
+
Add properties to be set per-message here, such as 'Content-Type', 'Priority'
|
180
|
+
|
181
|
+
Example:
|
182
|
+
[source,ruby]
|
183
|
+
message_properties => { "priority" => "1" }
|
184
|
+
|
185
|
+
|
172
186
|
[id="plugins-{type}s-{plugin}-passive"]
|
173
187
|
===== `passive`
|
174
188
|
|
@@ -38,12 +38,18 @@ module LogStash
|
|
38
38
|
# Should RabbitMQ persist messages to disk?
|
39
39
|
config :persistent, :validate => :boolean, :default => true
|
40
40
|
|
41
|
+
# Properties to be passed along with the message
|
42
|
+
config :message_properties, :validate => :hash, :default => {}
|
43
|
+
|
41
44
|
def register
|
42
45
|
connect!
|
43
46
|
@hare_info.exchange = declare_exchange!(@hare_info.channel, @exchange, @exchange_type, @durable)
|
44
47
|
@codec.on_event(&method(:publish))
|
45
48
|
end
|
46
49
|
|
50
|
+
def symbolize(myhash)
|
51
|
+
Hash[myhash.map{|(k,v)| [k.to_sym,v]}]
|
52
|
+
end
|
47
53
|
|
48
54
|
def receive(event)
|
49
55
|
@codec.encode(event)
|
@@ -53,7 +59,7 @@ module LogStash
|
|
53
59
|
|
54
60
|
def publish(event, message)
|
55
61
|
raise ArgumentError, "No exchange set in HareInfo!!!" unless @hare_info.exchange
|
56
|
-
@hare_info.exchange.publish(message, :routing_key => event.sprintf(@key), :properties =>
|
62
|
+
@hare_info.exchange.publish(message, :routing_key => event.sprintf(@key), :properties => symbolize(@message_properties.merge(:persistent => @persistent)))
|
57
63
|
rescue MarchHare::Exception, IOError, AlreadyClosedException, TimeoutException => e
|
58
64
|
@logger.error("Error while publishing. Will retry.",
|
59
65
|
:message => e.message,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-rabbitmq'
|
3
|
-
s.version = '4.0.
|
3
|
+
s.version = '4.0.9'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Push events to a RabbitMQ exchange"
|
6
6
|
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"
|
@@ -135,12 +135,16 @@ describe "with a live server", :integration => true do
|
|
135
135
|
let(:klass) { LogStash::Outputs::RabbitMQ }
|
136
136
|
let(:exchange) { "myexchange" }
|
137
137
|
let(:exchange_type) { "topic" }
|
138
|
+
let(:priority) { 34 }
|
138
139
|
let(:default_plugin_config) {
|
139
140
|
{
|
140
141
|
"host" => "127.0.0.1",
|
141
142
|
"exchange" => exchange,
|
142
143
|
"exchange_type" => exchange_type,
|
143
|
-
"key" => "foo"
|
144
|
+
"key" => "foo",
|
145
|
+
"message_properties" => {
|
146
|
+
"priority" => priority
|
147
|
+
}
|
144
148
|
}
|
145
149
|
}
|
146
150
|
let(:config) { default_plugin_config }
|
@@ -158,7 +162,7 @@ describe "with a live server", :integration => true do
|
|
158
162
|
# Extra time to make sure the output can attach
|
159
163
|
sleep 1
|
160
164
|
end
|
161
|
-
|
165
|
+
let(:message) { LogStash::Event.new("message" => "Foo Message", "extra_field" => "Blah") }
|
162
166
|
let(:test_connection) { MarchHare.connect(instance.send(:rabbitmq_settings)) }
|
163
167
|
let(:test_channel) { test_connection.create_channel }
|
164
168
|
let(:test_queue) {
|
@@ -190,6 +194,14 @@ describe "with a live server", :integration => true do
|
|
190
194
|
instance.close
|
191
195
|
expect(instance.connected?).to be_falsey
|
192
196
|
end
|
197
|
+
|
198
|
+
it 'applies per message settings' do
|
199
|
+
instance.receive(message)
|
200
|
+
sleep 1.0
|
201
|
+
|
202
|
+
message, payload = test_queue.pop
|
203
|
+
expect(message.properties.to_s).to include("priority=#{priority}")
|
204
|
+
end
|
193
205
|
end
|
194
206
|
|
195
207
|
describe "sending a message with an exchange specified" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.9
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|