logstash-output-irc 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +4 -4
- data/lib/logstash/outputs/irc.rb +11 -0
- data/logstash-output-irc.gemspec +4 -4
- data/spec/outputs/irc_spec.rb +39 -1
- data/spec/spec_helper.rb +3 -0
- metadata +26 -18
- data/.gitignore +0 -4
- data/Rakefile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e616651a8f2b2926775e56231c775c08f5c994a
|
4
|
+
data.tar.gz: 7a1341c809bd62330620d4c7f8a7a3320a720c15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1e96a3e33cff988f316b0ed3da0d914e15306edd2ab05d9b9805b1d4e801e691cc2d80885e95a85b658fd3ac93eacfe6780759211b9510ed78d0656bcb08c9b
|
7
|
+
data.tar.gz: cc52b2b23c099ac1cf268dafcea7ba5c7bcda3b8cf41ada63ba7b5e571d7c24f067148ffe09f70acb5b2974f34970dd43425ba74f74aa467682636d2ffe7f304
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
This is a plugin for [Logstash](https://github.com/
|
3
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
4
|
|
5
5
|
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
|
6
6
|
|
7
7
|
## Documentation
|
8
8
|
|
9
|
-
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.
|
9
|
+
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
|
10
10
|
|
11
11
|
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
12
|
-
- For more asciidoc formatting tips, see the excellent reference here https://github.com/
|
12
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
13
13
|
|
14
14
|
## Need Help?
|
15
15
|
|
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
|
|
83
83
|
|
84
84
|
It is more important to the community that you are able to contribute.
|
85
85
|
|
86
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/
|
86
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
data/lib/logstash/outputs/irc.rb
CHANGED
@@ -49,6 +49,16 @@ class LogStash::Outputs::Irc < LogStash::Outputs::Base
|
|
49
49
|
config :post_string, :validate => :string, :required => false
|
50
50
|
|
51
51
|
public
|
52
|
+
|
53
|
+
def inject_bot(bot)
|
54
|
+
@bot = bot
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def bot
|
59
|
+
@bot
|
60
|
+
end
|
61
|
+
|
52
62
|
def register
|
53
63
|
require "cinch"
|
54
64
|
@irc_queue = Queue.new
|
@@ -77,6 +87,7 @@ class LogStash::Outputs::Irc < LogStash::Outputs::Base
|
|
77
87
|
return unless output?(event)
|
78
88
|
@logger.debug("Sending message to channels", :event => event)
|
79
89
|
text = event.sprintf(@format)
|
90
|
+
|
80
91
|
@bot.channels.each do |channel|
|
81
92
|
@logger.debug("Sending to...", :channel => channel, :text => text)
|
82
93
|
channel.msg(pre_string) if !@pre_string.nil?
|
data/logstash-output-irc.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-irc'
|
4
|
-
s.version = '
|
4
|
+
s.version = '2.0.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Write events to IRC"
|
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"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files =
|
14
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core",
|
24
|
-
|
23
|
+
s.add_runtime_dependency "logstash-core", "~> 2.0.0.snapshot"
|
25
24
|
s.add_runtime_dependency 'cinch'
|
25
|
+
s.add_runtime_dependency 'logstash-codec-plain'
|
26
26
|
|
27
27
|
s.add_development_dependency 'logstash-devutils'
|
28
28
|
end
|
data/spec/outputs/irc_spec.rb
CHANGED
@@ -1 +1,39 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative "../spec_helper"
|
3
|
+
require "cinch"
|
4
|
+
|
5
|
+
describe LogStash::Outputs::Irc do
|
6
|
+
|
7
|
+
let(:host) { "localhost" }
|
8
|
+
let(:port) { rand(2048)+1024 }
|
9
|
+
|
10
|
+
let(:channels) { ["#logstash", "#elastic"] }
|
11
|
+
|
12
|
+
it "should register without errors" do
|
13
|
+
plugin = LogStash::Plugin.lookup("output", "irc").new("host" => host, "port" => port, "channels" => channels)
|
14
|
+
expect { plugin.register }.to_not raise_error
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#send" do
|
18
|
+
|
19
|
+
subject { LogStash::Outputs::Irc.new("host" => host, "port" => port, "channels" => channels ) }
|
20
|
+
|
21
|
+
let(:properties) { { "message" => "This is a message!"} }
|
22
|
+
let(:event) { LogStash::Event.new(properties) }
|
23
|
+
let(:channel) { double("channel") }
|
24
|
+
|
25
|
+
let(:bot) { Cinch::Bot.new }
|
26
|
+
|
27
|
+
before(:each) do
|
28
|
+
allow(channel).to receive(:msg)
|
29
|
+
subject.inject_bot(bot).register
|
30
|
+
expect(subject.bot).to receive(:channels).and_return([channel])
|
31
|
+
end
|
32
|
+
|
33
|
+
it "sends the generated event to the irc" do
|
34
|
+
expect(channel).to receive(:msg).with("This is a message!")
|
35
|
+
subject.receive(event)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,80 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
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-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ~>
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 2.0.0.snapshot
|
14
19
|
name: logstash-core
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
15
22
|
version_requirements: !ruby/object:Gem::Requirement
|
16
23
|
requirements:
|
17
|
-
- -
|
24
|
+
- - ~>
|
18
25
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 2.0.0
|
26
|
+
version: 2.0.0.snapshot
|
27
|
+
- !ruby/object:Gem::Dependency
|
23
28
|
requirement: !ruby/object:Gem::Requirement
|
24
29
|
requirements:
|
25
30
|
- - '>='
|
26
31
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 2.0.0
|
32
|
+
version: '0'
|
33
|
+
name: cinch
|
31
34
|
prerelease: false
|
32
35
|
type: :runtime
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: cinch
|
35
36
|
version_requirements: !ruby/object:Gem::Requirement
|
36
37
|
requirements:
|
37
38
|
- - '>='
|
38
39
|
- !ruby/object:Gem::Version
|
39
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
40
42
|
requirement: !ruby/object:Gem::Requirement
|
41
43
|
requirements:
|
42
44
|
- - '>='
|
43
45
|
- !ruby/object:Gem::Version
|
44
46
|
version: '0'
|
47
|
+
name: logstash-codec-plain
|
45
48
|
prerelease: false
|
46
49
|
type: :runtime
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: logstash-devutils
|
49
50
|
version_requirements: !ruby/object:Gem::Requirement
|
50
51
|
requirements:
|
51
52
|
- - '>='
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
54
56
|
requirement: !ruby/object:Gem::Requirement
|
55
57
|
requirements:
|
56
58
|
- - '>='
|
57
59
|
- !ruby/object:Gem::Version
|
58
60
|
version: '0'
|
61
|
+
name: logstash-devutils
|
59
62
|
prerelease: false
|
60
63
|
type: :development
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
61
69
|
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
70
|
email: info@elastic.co
|
63
71
|
executables: []
|
64
72
|
extensions: []
|
65
73
|
extra_rdoc_files: []
|
66
74
|
files:
|
67
|
-
- .gitignore
|
68
75
|
- CHANGELOG.md
|
69
76
|
- CONTRIBUTORS
|
70
77
|
- Gemfile
|
71
78
|
- LICENSE
|
72
79
|
- NOTICE.TXT
|
73
80
|
- README.md
|
74
|
-
- Rakefile
|
75
81
|
- lib/logstash/outputs/irc.rb
|
76
82
|
- logstash-output-irc.gemspec
|
77
83
|
- spec/outputs/irc_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
78
85
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
79
86
|
licenses:
|
80
87
|
- Apache License (2.0)
|
@@ -97,9 +104,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
104
|
version: '0'
|
98
105
|
requirements: []
|
99
106
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.4.8
|
101
108
|
signing_key:
|
102
109
|
specification_version: 4
|
103
110
|
summary: Write events to IRC
|
104
111
|
test_files:
|
105
112
|
- spec/outputs/irc_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
data/.gitignore
DELETED