logstash-input-redis-cluster 2.0.3 → 2.0.4
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/CHANGELOG.md +0 -0
- data/CONTRIBUTORS +0 -0
- data/Gemfile +2 -1
- data/LICENSE +0 -0
- data/NOTICE.TXT +0 -0
- data/README.md +0 -0
- data/lib/jedis-2.7.2.jar +0 -0
- data/lib/logstash/inputs/redis_cluster.rb +364 -330
- data/lib/org/apache/commons/commons-pool2/2.3/commons-pool2-2.3.jar +0 -0
- data/lib/redis/clients/jedis/2.7.2/jedis-2.7.2.jar +0 -0
- data/logstash-input-redis-cluster.gemspec +2 -1
- data/spec/inputs/redis_spec.rb +0 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3c3e95623f3ffc9e04ce65dabc3b23a8d375963
|
4
|
+
data.tar.gz: e82a979f444c1ea185f9ee9d95e7a208022bb368
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2cf58a65112ce42b6840ff4afbacbc444abef37074506a038942091c3ae739265e71f6c1c2532a3f1e7f92660700dce93509c06e021ea334368ff78db810448
|
7
|
+
data.tar.gz: 1a577020960613781b7146493e4fd26e1f80d009e872f13752697d20dbece3b65ed70cd1b9bb84ce4d43db891c7aae694c3cacfab2617bc182392946cfcb9455
|
data/CHANGELOG.md
CHANGED
File without changes
|
data/CONTRIBUTORS
CHANGED
File without changes
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
File without changes
|
data/NOTICE.TXT
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/lib/jedis-2.7.2.jar
ADDED
Binary file
|
@@ -1,330 +1,364 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "logstash/namespace"
|
3
|
-
require "logstash/inputs/base"
|
4
|
-
require "logstash/inputs/threadable"
|
5
|
-
|
6
|
-
# This input will read events from a Redis instance; it supports both Redis channels and lists.
|
7
|
-
# The list command (BLPOP) used by Logstash is supported in Redis v1.3.1+, and
|
8
|
-
# the channel commands used by Logstash are found in Redis v1.3.8+.
|
9
|
-
# While you may be able to make these Redis versions work, the best performance
|
10
|
-
# and stability will be found in more recent stable versions. Versions 2.6.0+
|
11
|
-
# are recommended.
|
12
|
-
#
|
13
|
-
# For more information about Redis, see <http://redis.io/>
|
14
|
-
#
|
15
|
-
# `batch_count` note: If you use the `batch_count` setting, you *must* use a Redis version 2.6.0 or
|
16
|
-
# newer. Anything older does not support the operations used by batching.
|
17
|
-
#
|
18
|
-
module LogStash module Inputs class RedisCluster < LogStash::Inputs::Threadable
|
19
|
-
# class LogStash::Inputs::Redis < LogStash::Inputs::Threadable
|
20
|
-
|
21
|
-
config_name "redis_cluster"
|
22
|
-
|
23
|
-
default :codec, "json"
|
24
|
-
|
25
|
-
# The `name` configuration is used for logging in case there are multiple instances.
|
26
|
-
# This feature has no real function and will be removed in future versions.
|
27
|
-
config :name, :validate => :string, :default => "default", :deprecated => true
|
28
|
-
|
29
|
-
# The hostname of your Redis server.
|
30
|
-
config :host, :validate => :string, :default => "127.0.0.1"
|
31
|
-
|
32
|
-
# The
|
33
|
-
config :
|
34
|
-
|
35
|
-
# The
|
36
|
-
config :
|
37
|
-
|
38
|
-
#
|
39
|
-
config :
|
40
|
-
|
41
|
-
#
|
42
|
-
config :
|
43
|
-
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
#
|
51
|
-
# TODO: change required to true
|
52
|
-
config :
|
53
|
-
|
54
|
-
#
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# use to
|
66
|
-
def
|
67
|
-
@
|
68
|
-
self
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
# TODO
|
103
|
-
|
104
|
-
@
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
# private
|
141
|
-
def
|
142
|
-
|
143
|
-
end
|
144
|
-
|
145
|
-
# private
|
146
|
-
def
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
# private
|
175
|
-
def
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/namespace"
|
3
|
+
require "logstash/inputs/base"
|
4
|
+
require "logstash/inputs/threadable"
|
5
|
+
|
6
|
+
# This input will read events from a Redis instance; it supports both Redis channels and lists.
|
7
|
+
# The list command (BLPOP) used by Logstash is supported in Redis v1.3.1+, and
|
8
|
+
# the channel commands used by Logstash are found in Redis v1.3.8+.
|
9
|
+
# While you may be able to make these Redis versions work, the best performance
|
10
|
+
# and stability will be found in more recent stable versions. Versions 2.6.0+
|
11
|
+
# are recommended.
|
12
|
+
#
|
13
|
+
# For more information about Redis, see <http://redis.io/>
|
14
|
+
#
|
15
|
+
# `batch_count` note: If you use the `batch_count` setting, you *must* use a Redis version 2.6.0 or
|
16
|
+
# newer. Anything older does not support the operations used by batching.
|
17
|
+
#
|
18
|
+
module LogStash module Inputs class RedisCluster < LogStash::Inputs::Threadable
|
19
|
+
# class LogStash::Inputs::Redis < LogStash::Inputs::Threadable
|
20
|
+
|
21
|
+
config_name "redis_cluster"
|
22
|
+
|
23
|
+
default :codec, "json"
|
24
|
+
|
25
|
+
# The `name` configuration is used for logging in case there are multiple instances.
|
26
|
+
# This feature has no real function and will be removed in future versions.
|
27
|
+
config :name, :validate => :string, :default => "default", :deprecated => true
|
28
|
+
|
29
|
+
# The hostname of your Redis server.
|
30
|
+
config :host, :validate => :string, :default => "127.0.0.1"
|
31
|
+
|
32
|
+
# The hostname of your Redis server.
|
33
|
+
config :driver, :validate => :string, :default => "jedis"
|
34
|
+
|
35
|
+
# The port to connect on.
|
36
|
+
config :port, :validate => :number, :default => 6379
|
37
|
+
|
38
|
+
# The Redis database number.
|
39
|
+
config :db, :validate => :number, :default => 0
|
40
|
+
|
41
|
+
# Initial connection timeout in seconds.
|
42
|
+
config :timeout, :validate => :number, :default => 5
|
43
|
+
|
44
|
+
# Initial connection timeout in seconds.
|
45
|
+
config :max_connections, :validate => :number, :default => 256
|
46
|
+
|
47
|
+
# Password to authenticate with. There is no authentication by default.
|
48
|
+
config :password, :validate => :password
|
49
|
+
|
50
|
+
# The name of a Redis list or channel.
|
51
|
+
# TODO: change required to true
|
52
|
+
config :keys, :validate => :array
|
53
|
+
|
54
|
+
# Specify either list or channel. If `redis\_type` is `list`, then we will BLPOP the
|
55
|
+
# key. If `redis\_type` is `channel`, then we will SUBSCRIBE to the key.
|
56
|
+
# If `redis\_type` is `pattern_channel`, then we will PSUBSCRIBE to the key.
|
57
|
+
# TODO: change required to true
|
58
|
+
config :data_type, :validate => [ "list", "channel", "pattern_channel" ], :required => false
|
59
|
+
|
60
|
+
# The number of events to return from Redis using EVAL.
|
61
|
+
config :batch_count, :validate => :number, :default => 1
|
62
|
+
|
63
|
+
public
|
64
|
+
# public API
|
65
|
+
# use to store a proc that can provide a redis instance or mock
|
66
|
+
def add_external_redis_builder(builder) #callable
|
67
|
+
@redis_builder = builder
|
68
|
+
self
|
69
|
+
end
|
70
|
+
|
71
|
+
# use to apply an instance directly and bypass the builder
|
72
|
+
def use_redis(instance)
|
73
|
+
@redis = instance
|
74
|
+
self
|
75
|
+
end
|
76
|
+
|
77
|
+
def new_redis_instance
|
78
|
+
@redis_builder.call
|
79
|
+
end
|
80
|
+
|
81
|
+
def register
|
82
|
+
@redis_url = "redis://#{@password}@#{@host}:#{@port}/#{@db}"
|
83
|
+
|
84
|
+
@batch_offset = Random.rand(1024)
|
85
|
+
# TODO remove after setting key and data_type to true
|
86
|
+
|
87
|
+
|
88
|
+
if @driver == "jedis" then
|
89
|
+
require 'org/apache/commons/commons-pool2/2.3/commons-pool2-2.3.jar'
|
90
|
+
require 'redis/clients/jedis/2.7.2/jedis-2.7.2.jar'
|
91
|
+
@error_handler = method(:error_handler_jedis)
|
92
|
+
else
|
93
|
+
require 'org/apache/commons/commons-pool2/2.3/redis-rb-cluster'
|
94
|
+
@error_handler = method(:error_handler_redis)
|
95
|
+
end
|
96
|
+
|
97
|
+
if !@keys || !@data_type
|
98
|
+
raise RuntimeError.new(
|
99
|
+
"Must define queue, or key and data_type parameters"
|
100
|
+
)
|
101
|
+
end
|
102
|
+
# end TODO
|
103
|
+
|
104
|
+
@redis_builder ||= method(:internal_redis_builder)
|
105
|
+
|
106
|
+
# just switch on data_type once
|
107
|
+
if @data_type == 'list' || @data_type == 'dummy'
|
108
|
+
@run_method = method(:list_runner)
|
109
|
+
@stop_method = method(:list_stop)
|
110
|
+
elsif @data_type == 'channel'
|
111
|
+
@run_method = method(:channel_runner)
|
112
|
+
@stop_method = method(:subscribe_stop)
|
113
|
+
elsif @data_type == 'pattern_channel'
|
114
|
+
@run_method = method(:pattern_channel_runner)
|
115
|
+
@stop_method = method(:subscribe_stop)
|
116
|
+
end
|
117
|
+
|
118
|
+
# TODO(sissel, boertje): set @identity directly when @name config option is removed.
|
119
|
+
@identity = @name != 'default' ? @name : "#{@redis_url} #{@data_type}"
|
120
|
+
@logger.info("Registering Redis", :identity => @identity)
|
121
|
+
end # def register
|
122
|
+
|
123
|
+
def run(output_queue)
|
124
|
+
@run_method.call(output_queue)
|
125
|
+
rescue LogStash::ShutdownSignal
|
126
|
+
# ignore and quit
|
127
|
+
end # def run
|
128
|
+
|
129
|
+
def stop
|
130
|
+
@stop_method.call
|
131
|
+
end
|
132
|
+
|
133
|
+
# private methods -----------------------------
|
134
|
+
private
|
135
|
+
|
136
|
+
def batched?
|
137
|
+
@batch_count > 1
|
138
|
+
end
|
139
|
+
|
140
|
+
# private
|
141
|
+
def is_list_type?
|
142
|
+
@data_type == 'list'
|
143
|
+
end
|
144
|
+
|
145
|
+
# private
|
146
|
+
def redis_params
|
147
|
+
{
|
148
|
+
:host => @host,
|
149
|
+
:port => @port,
|
150
|
+
:db => @db,
|
151
|
+
:password => @password.nil? ? nil : @password.value,
|
152
|
+
:driver => @driver,
|
153
|
+
:timeout => @timeout
|
154
|
+
}
|
155
|
+
end
|
156
|
+
|
157
|
+
# private
|
158
|
+
def internal_redis_builder
|
159
|
+
if @driver == "jedis" then
|
160
|
+
import "redis.clients.jedis.JedisCluster"
|
161
|
+
import "redis.clients.jedis.HostAndPort"
|
162
|
+
::JedisCluster.new(java.util.HashSet.new([HostAndPort.new(redis_params[:host],redis_params[:port])]))
|
163
|
+
else
|
164
|
+
::RedisCluster.new([redis_params], @max_connections)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# private
|
169
|
+
def connect
|
170
|
+
redis = new_redis_instance
|
171
|
+
redis
|
172
|
+
end # def connect
|
173
|
+
|
174
|
+
# private
|
175
|
+
def load_batch_script(redis)
|
176
|
+
#A Redis Lua EVAL script to fetch a count of keys
|
177
|
+
#in case count is bigger than current items in queue whole queue will be returned without extra nil values
|
178
|
+
redis_script = <<EOF
|
179
|
+
local i = tonumber(ARGV[1])
|
180
|
+
local res = {}
|
181
|
+
local length = redis.call('llen',KEYS[1])
|
182
|
+
if length < i then i = length end
|
183
|
+
while (i > 0) do
|
184
|
+
local item = redis.call("lpop", KEYS[1])
|
185
|
+
if (not item) then
|
186
|
+
break
|
187
|
+
end
|
188
|
+
table.insert(res, item)
|
189
|
+
i = i-1
|
190
|
+
end
|
191
|
+
return res
|
192
|
+
EOF
|
193
|
+
@redis_script_sha = redis.script(:load, redis_script)
|
194
|
+
end
|
195
|
+
|
196
|
+
# private
|
197
|
+
def queue_event(msg, output_queue)
|
198
|
+
begin
|
199
|
+
@codec.decode(msg) do |event|
|
200
|
+
decorate(event)
|
201
|
+
output_queue << event
|
202
|
+
end
|
203
|
+
rescue => e # parse or event creation error
|
204
|
+
@logger.error("Failed to create event", :message => msg, :exception => e, :backtrace => e.backtrace);
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# private
|
209
|
+
def list_stop
|
210
|
+
return if @redis.nil? || !@redis.connected?
|
211
|
+
|
212
|
+
@redis.quit rescue nil
|
213
|
+
@redis = nil
|
214
|
+
end
|
215
|
+
|
216
|
+
# private
|
217
|
+
def error_handler_redis(func)
|
218
|
+
begin
|
219
|
+
func.call
|
220
|
+
rescue ::Redis::BaseError => e
|
221
|
+
@logger.warn("Redis connection problem", :exception => e)
|
222
|
+
# Reset the redis variable to trigger reconnect
|
223
|
+
@redis = nil
|
224
|
+
|
225
|
+
return false
|
226
|
+
end
|
227
|
+
|
228
|
+
return true
|
229
|
+
end
|
230
|
+
|
231
|
+
def error_handler_jedis(func)
|
232
|
+
import "redis.clients.jedis.exceptions.JedisException"
|
233
|
+
begin
|
234
|
+
func.call
|
235
|
+
rescue ::JedisException => e
|
236
|
+
@logger.warn("Redis connection problem", :exception => e)
|
237
|
+
# Reset the redis variable to trigger reconnect
|
238
|
+
@redis = nil
|
239
|
+
|
240
|
+
return false
|
241
|
+
end
|
242
|
+
|
243
|
+
return true
|
244
|
+
end
|
245
|
+
|
246
|
+
# private
|
247
|
+
def list_runner(output_queue)
|
248
|
+
while !stop?
|
249
|
+
if !@error_handler.call(lambda {
|
250
|
+
@redis ||= connect
|
251
|
+
list_listener(@redis, output_queue)
|
252
|
+
}) then
|
253
|
+
sleep 1
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# private
|
259
|
+
def list_listener(redis, output_queue)
|
260
|
+
if batched? then
|
261
|
+
for i in 1..@batch_count do
|
262
|
+
item = redis.lpop(@keys[(i+@batch_offset)%(@keys.length)])
|
263
|
+
queue_event(item, output_queue) if item
|
264
|
+
end
|
265
|
+
@batch_offset += 1
|
266
|
+
end
|
267
|
+
|
268
|
+
sampled = @keys.sample
|
269
|
+
if @driver == "jedis" then
|
270
|
+
item = redis.blpop(1, sampled)
|
271
|
+
else
|
272
|
+
item = redis.blpop(sampled, :timeout => 1)
|
273
|
+
end
|
274
|
+
return unless item # from timeout or other conditions
|
275
|
+
|
276
|
+
# blpop returns the 'key' read from as well as the item result
|
277
|
+
# we only care about the result (2nd item in the list).
|
278
|
+
if @driver == "jedis" then
|
279
|
+
item = item.get(item.size()-1);
|
280
|
+
else
|
281
|
+
item = item.last
|
282
|
+
end
|
283
|
+
queue_event(item, output_queue)
|
284
|
+
end
|
285
|
+
|
286
|
+
# private
|
287
|
+
def subscribe_stop
|
288
|
+
return if @redis.nil? || !@redis.connected?
|
289
|
+
# if its a SubscribedClient then:
|
290
|
+
# it does not have a disconnect method (yet)
|
291
|
+
if @driver == "jedis" then
|
292
|
+
@redis.quit
|
293
|
+
elsif @redis.client.is_a?(::Redis::SubscribedClient)
|
294
|
+
@redis.client.unsubscribe
|
295
|
+
else
|
296
|
+
@redis.client.disconnect
|
297
|
+
end
|
298
|
+
@redis = nil
|
299
|
+
end
|
300
|
+
|
301
|
+
# private
|
302
|
+
def redis_runner
|
303
|
+
if @error_handler.call(lambda {
|
304
|
+
@redis ||= connect
|
305
|
+
}) then
|
306
|
+
yield
|
307
|
+
else
|
308
|
+
# Reset the redis variable to trigger reconnect
|
309
|
+
@redis = nil
|
310
|
+
Stud.stoppable_sleep(1) { stop? }
|
311
|
+
retry if !stop?
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# private
|
316
|
+
def channel_runner(output_queue)
|
317
|
+
redis_runner do
|
318
|
+
channel_listener(output_queue)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
# private
|
323
|
+
def channel_listener(output_queue)
|
324
|
+
@redis.subscribe(@keys.sample) do |on|
|
325
|
+
on.subscribe do |channel, count|
|
326
|
+
@logger.info("Subscribed", :channel => channel, :count => count)
|
327
|
+
end
|
328
|
+
|
329
|
+
on.message do |channel, message|
|
330
|
+
queue_event(message, output_queue)
|
331
|
+
end
|
332
|
+
|
333
|
+
on.unsubscribe do |channel, count|
|
334
|
+
@logger.info("Unsubscribed", :channel => channel, :count => count)
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
def pattern_channel_runner(output_queue)
|
340
|
+
redis_runner do
|
341
|
+
pattern_channel_listener(output_queue)
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
# private
|
346
|
+
def pattern_channel_listener(output_queue)
|
347
|
+
@redis.psubscribe @keys.sample do |on|
|
348
|
+
on.psubscribe do |channel, count|
|
349
|
+
@logger.info("Subscribed", :channel => channel, :count => count)
|
350
|
+
end
|
351
|
+
|
352
|
+
on.pmessage do |pattern, channel, message|
|
353
|
+
queue_event(message, output_queue)
|
354
|
+
end
|
355
|
+
|
356
|
+
on.punsubscribe do |channel, count|
|
357
|
+
@logger.info("Unsubscribed", :channel => channel, :count => count)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# end
|
363
|
+
|
364
|
+
end end end # Redis Inputs LogStash
|
Binary file
|
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-redis-cluster'
|
4
|
-
s.version = '2.0.
|
4
|
+
s.version = '2.0.4'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This input will read events from a Redis instance"
|
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"
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency "logstash-core", ">= 2.0.0.beta2", "< 3.0.0"
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'logstash-codec-json'
|
26
|
+
s.add_runtime_dependency "hiredis", "~> 0.4.0"
|
26
27
|
s.add_runtime_dependency 'redis-rb-cluster'
|
27
28
|
|
28
29
|
s.add_development_dependency 'logstash-devutils'
|
data/spec/inputs/redis_spec.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-redis-cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ~>
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.4.0
|
53
|
+
name: hiredis
|
54
|
+
prerelease: false
|
55
|
+
type: :runtime
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.4.0
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
requirement: !ruby/object:Gem::Requirement
|
49
63
|
requirements:
|
@@ -84,7 +98,10 @@ files:
|
|
84
98
|
- LICENSE
|
85
99
|
- NOTICE.TXT
|
86
100
|
- README.md
|
101
|
+
- lib/jedis-2.7.2.jar
|
87
102
|
- lib/logstash/inputs/redis_cluster.rb
|
103
|
+
- lib/org/apache/commons/commons-pool2/2.3/commons-pool2-2.3.jar
|
104
|
+
- lib/redis/clients/jedis/2.7.2/jedis-2.7.2.jar
|
88
105
|
- logstash-input-redis-cluster.gemspec
|
89
106
|
- spec/inputs/redis_spec.rb
|
90
107
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|