logstash-output-rabbitmq 0.1.1-java → 0.1.2-java
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 +4 -4
- data/lib/logstash/outputs/rabbitmq/march_hare.rb +7 -10
- data/logstash-output-rabbitmq.gemspec +3 -1
- data/spec/outputs/rabbitmq_spec.rb +72 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ff0be1aa78b095c7ad01148f38c96ca2843104
|
4
|
+
data.tar.gz: a9c14cddefb9ad39dddc3a6df85ff26cc63fe90a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02940932f7ca5c3fe8f628fead0c48bc8152d7f2bd06c588957dccf96e4d5d4e764663c7811b724332fc633266b7edaeba134f108b2e1aacbacf02c99bef70e6
|
7
|
+
data.tar.gz: 8f1544c17b1bfe0e0e80c8a690c93b82d8739892b83199ee0e3194ffd471f053946a4cd765dc896ad74c36a7af792fd3d9e18d2566ad1bc91b16091383086d04
|
@@ -16,7 +16,7 @@ class LogStash::Outputs::RabbitMQ
|
|
16
16
|
@connected = java.util.concurrent.atomic.AtomicBoolean.new
|
17
17
|
|
18
18
|
connect
|
19
|
-
declare_exchange
|
19
|
+
@x = declare_exchange
|
20
20
|
|
21
21
|
@connected.set(true)
|
22
22
|
|
@@ -29,18 +29,15 @@ class LogStash::Outputs::RabbitMQ
|
|
29
29
|
|
30
30
|
begin
|
31
31
|
@codec.encode(event)
|
32
|
-
rescue
|
33
|
-
@logger.warn("
|
34
|
-
:event => event)
|
32
|
+
rescue => e
|
33
|
+
@logger.warn("Error encoding event", :exception => e, :event => event)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
|
-
def publish_serialized(message)
|
37
|
+
def publish_serialized(event, message)
|
39
38
|
begin
|
40
39
|
if @connected.get
|
41
|
-
@x.publish(message, :routing_key => @key, :properties => {
|
42
|
-
:persistent => @persistent
|
43
|
-
})
|
40
|
+
@x.publish(message, :routing_key => event.sprintf(@key), :properties => { :persistent => @persistent })
|
44
41
|
else
|
45
42
|
@logger.warn("Tried to send a message, but not connected to RabbitMQ.")
|
46
43
|
end
|
@@ -131,12 +128,12 @@ class LogStash::Outputs::RabbitMQ
|
|
131
128
|
def declare_exchange
|
132
129
|
@logger.debug("Declaring an exchange", :name => @exchange, :type => @exchange_type,
|
133
130
|
:durable => @durable)
|
134
|
-
|
131
|
+
x = @ch.exchange(@exchange, :type => @exchange_type.to_sym, :durable => @durable)
|
135
132
|
|
136
133
|
# sets @connected to true during recovery. MK.
|
137
134
|
@connected.set(true)
|
138
135
|
|
139
|
-
|
136
|
+
x
|
140
137
|
end
|
141
138
|
|
142
139
|
end # MarchHareImpl
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-rabbitmq'
|
4
|
-
s.version = '0.1.
|
4
|
+
s.version = '0.1.2'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Push events to a RabbitMQ exchange"
|
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/plugin install gemname. This gem is not a stand-alone program"
|
@@ -30,5 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
end
|
31
31
|
|
32
32
|
s.add_development_dependency 'logstash-devutils'
|
33
|
+
s.add_development_dependency 'logstash-input-generator'
|
34
|
+
s.add_development_dependency 'logstash-codec-json'
|
33
35
|
end
|
34
36
|
|
@@ -1 +1,72 @@
|
|
1
|
-
require "logstash/devutils/rspec/spec_helper"
|
1
|
+
require "logstash/devutils/rspec/spec_helper"
|
2
|
+
|
3
|
+
require "logstash/pipeline"
|
4
|
+
require "logstash/outputs/rabbitmq"
|
5
|
+
|
6
|
+
describe LogStash::Outputs::RabbitMQ do
|
7
|
+
|
8
|
+
describe "rabbitmq static key" do
|
9
|
+
config <<-END
|
10
|
+
input {
|
11
|
+
generator {
|
12
|
+
count => 1
|
13
|
+
}
|
14
|
+
}
|
15
|
+
output {
|
16
|
+
rabbitmq {
|
17
|
+
host => "localhost"
|
18
|
+
exchange_type => "topic"
|
19
|
+
exchange => "foo"
|
20
|
+
key => "bar"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
END
|
24
|
+
|
25
|
+
it "should use defined key" do
|
26
|
+
exchange = double("exchange")
|
27
|
+
expect_any_instance_of(LogStash::Outputs::RabbitMQ).to receive(:connect).and_return(nil)
|
28
|
+
expect_any_instance_of(LogStash::Outputs::RabbitMQ).to receive(:declare_exchange).and_return(exchange)
|
29
|
+
|
30
|
+
expect(exchange).to receive(:publish).with(an_instance_of(String), {:routing_key => "bar", :properties => {:persistent => true}})
|
31
|
+
|
32
|
+
# we need to set expectations before running the pipeline, this is why we cannot use the
|
33
|
+
# "agent" spec construct here so we do it manually
|
34
|
+
pipeline = LogStash::Pipeline.new(config)
|
35
|
+
pipeline.run
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "rabbitmq key with dynamic field" do
|
41
|
+
config <<-END
|
42
|
+
input {
|
43
|
+
generator {
|
44
|
+
count => 1
|
45
|
+
add_field => ["foo", "bar"]
|
46
|
+
}
|
47
|
+
}
|
48
|
+
output {
|
49
|
+
rabbitmq {
|
50
|
+
host => "localhost"
|
51
|
+
exchange_type => "topic"
|
52
|
+
exchange => "foo"
|
53
|
+
key => "%{foo}"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
END
|
57
|
+
|
58
|
+
it "should populate the key with the content of the event foo field" do
|
59
|
+
exchange = double("exchange")
|
60
|
+
expect_any_instance_of(LogStash::Outputs::RabbitMQ).to receive(:connect).and_return(nil)
|
61
|
+
expect_any_instance_of(LogStash::Outputs::RabbitMQ).to receive(:declare_exchange).and_return(exchange)
|
62
|
+
|
63
|
+
expect(exchange).to receive(:publish).with(an_instance_of(String), {:routing_key => "bar", :properties => {:persistent => true}})
|
64
|
+
|
65
|
+
# we need to set expectations before running the pipeline, this is why we cannot use the
|
66
|
+
# "agent" spec construct here so we do it manually
|
67
|
+
pipeline = LogStash::Pipeline.new(config)
|
68
|
+
pipeline.run
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
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: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elasticsearch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,6 +58,34 @@ dependencies:
|
|
58
58
|
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
name: logstash-input-generator
|
68
|
+
prerelease: false
|
69
|
+
type: :development
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
name: logstash-codec-json
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
61
89
|
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
|
62
90
|
email: info@elasticsearch.com
|
63
91
|
executables: []
|