logstash-output-websocket_topics 2.1.8 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/outputs/websocket_topics.rb +8 -11
- data/lib/logstash/outputs/{websocket → websocket_topics}/app.rb +0 -0
- data/lib/logstash/outputs/{websocket → websocket_topics}/pubsub.rb +1 -1
- data/logstash-output-websocket_topics.gemspec +1 -1
- data/spec/outputs/websocket_topics_spec.rb +17 -0
- metadata +6 -6
- data/spec/outputs/websocket_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 338fd64ac8c5da5276c2f72482df84fad68e214a
|
4
|
+
data.tar.gz: cb2898519383759bab5e2577ae509f2e754128f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5bb6394e9e53dfc8f751b32dab8e0fa61a976e4485e1390d2ab8c5d1056cecdbef1104bf9af4b7aa60c8a475818059fbbd3e632d420103bda3b864ccfb4200f
|
7
|
+
data.tar.gz: 87274dd58434fe740fb53edbbcef0451237114c26a163b02a0977a37de4559d5824921c6467fca87ee358fc8bcbffe0842d447a19d76d1c8af9b315feb37ec47
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require "json"
|
2
3
|
require "logstash/namespace"
|
3
4
|
require "logstash/outputs/base"
|
4
5
|
|
5
|
-
|
6
6
|
# This output runs a websocket server and publishes any
|
7
7
|
# messages to all connected websocket clients.
|
8
8
|
#
|
@@ -18,16 +18,10 @@ class LogStash::Outputs::WebSocket < LogStash::Outputs::Base
|
|
18
18
|
# The port to serve websocket data from
|
19
19
|
config :port, :validate => :number, :default => 3232
|
20
20
|
|
21
|
-
def make_pubsub(topic)
|
22
|
-
pubsub = Logstash::Outputs::WebSocket::Pubsub.new
|
23
|
-
pubsub.logger = @logger
|
24
|
-
end
|
25
|
-
|
26
21
|
public
|
27
22
|
def register
|
28
23
|
require "ftw"
|
29
|
-
require "logstash/outputs/
|
30
|
-
require "logstash/outputs/websocket/pubsub"
|
24
|
+
require "logstash/outputs/websocket_topics/app"
|
31
25
|
@channels = {}
|
32
26
|
@server = Thread.new(@channels) do |channels|
|
33
27
|
begin
|
@@ -44,12 +38,15 @@ class LogStash::Outputs::WebSocket < LogStash::Outputs::Base
|
|
44
38
|
public
|
45
39
|
def receive(event)
|
46
40
|
topic = event['topic']
|
41
|
+
json = JSON.generate(event)
|
47
42
|
if @channels.has_key?(topic)
|
48
|
-
@channels[topic].publish(
|
43
|
+
@channels[topic].publish(json)
|
49
44
|
else
|
50
|
-
pubsub
|
45
|
+
require "logstash/outputs/websocket_topics/pubsub"
|
46
|
+
pubsub = LogStash::Outputs::WebSocket::Pubsub.new
|
47
|
+
pubsub.logger = @logger
|
51
48
|
@channels[topic] = pubsub
|
52
|
-
pubsub.publish(
|
49
|
+
pubsub.publish(json)
|
53
50
|
end # if
|
54
51
|
end # def receive
|
55
52
|
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-websocket_topics'
|
4
|
-
s.version = '2.1.
|
4
|
+
s.version = '2.1.9'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This output runs a websocket server and publishes any messages to those conencted clients that have subscribed to the topic being published."
|
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"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/devutils/rspec/spec_helper"
|
3
|
+
require "logstash/outputs/websocket_topics"
|
4
|
+
|
5
|
+
describe "output/websocket_topics" do
|
6
|
+
|
7
|
+
subject(:output) { LogStash::Outputs::WebSocket.new }
|
8
|
+
|
9
|
+
it "should register" do
|
10
|
+
expect {output.register}.to_not raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should receive a simple message with a topic" do
|
14
|
+
output.register()
|
15
|
+
expect {output.receive({ "topic" => "blah" })}.to_not raise_error
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-websocket_topics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Osheroff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|
@@ -98,11 +98,11 @@ files:
|
|
98
98
|
- LICENSE
|
99
99
|
- NOTICE.TXT
|
100
100
|
- README.md
|
101
|
-
- lib/logstash/outputs/websocket/app.rb
|
102
|
-
- lib/logstash/outputs/websocket/pubsub.rb
|
103
101
|
- lib/logstash/outputs/websocket_topics.rb
|
102
|
+
- lib/logstash/outputs/websocket_topics/app.rb
|
103
|
+
- lib/logstash/outputs/websocket_topics/pubsub.rb
|
104
104
|
- logstash-output-websocket_topics.gemspec
|
105
|
-
- spec/outputs/
|
105
|
+
- spec/outputs/websocket_topics_spec.rb
|
106
106
|
homepage: ''
|
107
107
|
licenses:
|
108
108
|
- Apache License (2.0)
|
@@ -130,4 +130,4 @@ signing_key:
|
|
130
130
|
specification_version: 4
|
131
131
|
summary: This output runs a websocket server and publishes any messages to those conencted clients that have subscribed to the topic being published.
|
132
132
|
test_files:
|
133
|
-
- spec/outputs/
|
133
|
+
- spec/outputs/websocket_topics_spec.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "logstash/devutils/rspec/spec_helper"
|
3
|
-
require "logstash/outputs/websocket"
|
4
|
-
|
5
|
-
describe "output/websocket" do
|
6
|
-
|
7
|
-
subject(:output) { LogStash::Outputs::WebSocket.new }
|
8
|
-
|
9
|
-
it "should register" do
|
10
|
-
expect {output.register}.to_not raise_error
|
11
|
-
end
|
12
|
-
end
|