logstash-output-email 0.1.4 → 0.1.5
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/logstash-output-email.gemspec +3 -1
- data/spec/outputs/email_spec.rb +77 -156
- data/spec/spec_helper.rb +14 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f085459b9db87c0c9c6eb079defba873911eb464
|
4
|
+
data.tar.gz: fe56329e0b007e861e1739ced41fda3902d943bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7dac18b32d606fe333c64947d60189cb6ef908aebc24c90eb3d05592c1a3a8d41885f86f5b28bcc9db8864c2e6a99a3a335d5c3181c3a944747eb8ade5d7c12
|
7
|
+
data.tar.gz: 8f0e5ac3ee3874a59368cf8c4f023441bdaf62b684c481cec7bf71c14353373a047a3009864f77ccecb86ee08988f4976694bafb21933131ee62c4af6906c043
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-email'
|
4
|
-
s.version = '0.1.
|
4
|
+
s.version = '0.1.5'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Send email when an output is received."
|
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"
|
@@ -26,5 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
|
27
27
|
s.add_development_dependency 'logstash-devutils'
|
28
28
|
s.add_development_dependency 'rumbster'
|
29
|
+
s.add_development_dependency 'logstash-input-generator'
|
30
|
+
|
29
31
|
end
|
30
32
|
|
data/spec/outputs/email_spec.rb
CHANGED
@@ -1,173 +1,94 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
2
3
|
require "rumbster"
|
3
4
|
require "message_observers"
|
4
5
|
|
5
|
-
describe "outputs/email"
|
6
|
-
|
6
|
+
describe "outputs/email" do
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
port = 2525
|
9
|
+
let (:rumbster) { Rumbster.new(port) }
|
10
|
+
let (:message_observer) { MailMessageObserver.new }
|
11
|
+
plugin = LogStash::Plugin.lookup("output", "email")
|
11
12
|
|
12
|
-
before :each do
|
13
|
-
rumbster.add_observer message_observer
|
14
|
-
rumbster.start
|
15
|
-
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
before :each do
|
15
|
+
rumbster.add_observer message_observer
|
16
|
+
rumbster.start
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
generator {
|
25
|
-
message => "hello world"
|
26
|
-
count => 1
|
27
|
-
type => "generator"
|
28
|
-
}
|
29
|
-
}
|
30
|
-
filter {
|
31
|
-
noop {
|
32
|
-
add_field => ["dummy_match", "ok"]
|
33
|
-
}
|
34
|
-
}
|
35
|
-
output{
|
36
|
-
email {
|
37
|
-
to => "email1@host, email2@host"
|
38
|
-
match => ["mymatch", "dummy_match,ok"]
|
39
|
-
options => ["port", #{port}]
|
40
|
-
}
|
41
|
-
}
|
42
|
-
CONFIG
|
19
|
+
after :each do
|
20
|
+
rumbster.stop
|
21
|
+
end
|
43
22
|
|
44
|
-
|
45
|
-
insist {message_observer.messages.size} == 1
|
46
|
-
insist {message_observer.messages[0].to} == ["email1@host", "email2@host"]
|
47
|
-
end
|
48
|
-
end
|
23
|
+
describe "use a list of email as mail.to (LOGSTASH-827)" do
|
49
24
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
filter {
|
60
|
-
noop {
|
61
|
-
add_field => ["dummy_match", "ok"]
|
62
|
-
add_field => ["to_addr", "email1@host"]
|
63
|
-
add_field => ["to_addr", "email2@host"]
|
64
|
-
}
|
65
|
-
}
|
66
|
-
output{
|
67
|
-
email {
|
68
|
-
to => "%{to_addr}"
|
69
|
-
match => ["mymatch", "dummy_match,ok"]
|
70
|
-
options => ["port", #{port}]
|
71
|
-
}
|
72
|
-
}
|
73
|
-
CONFIG
|
74
|
-
|
75
|
-
agent do
|
76
|
-
insist {message_observer.messages.size} == 1
|
77
|
-
insist {message_observer.messages[0].to} == ["email1@host", "email2@host"]
|
78
|
-
end
|
25
|
+
it "supports list of emails in to field" do
|
26
|
+
subject = plugin.new("to" => ["email1@host, email2@host"],
|
27
|
+
"match" => ["mymatch", "dummy_match,ok"],
|
28
|
+
"options" => ["port", port])
|
29
|
+
subject.register
|
30
|
+
subject.receive(LogStash::Event.new("message" => "hello", "dummy_match" => "ok"))
|
31
|
+
expect(message_observer.messages.size).to eq(1)
|
32
|
+
expect(message_observer.messages[0].to).to eq(["email1@host", "email2@host"])
|
79
33
|
end
|
80
34
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
noop {
|
92
|
-
add_field => ["dummy_match", "ok"]
|
93
|
-
}
|
94
|
-
}
|
95
|
-
output{
|
96
|
-
email {
|
97
|
-
to => "me@host"
|
98
|
-
subject => "Hello World"
|
99
|
-
body => "Line1\\nLine2\\nLine3"
|
100
|
-
match => ["mymatch", "dummy_match,*"]
|
101
|
-
options => ["port", #{port}]
|
102
|
-
}
|
103
|
-
}
|
104
|
-
CONFIG
|
105
|
-
|
106
|
-
agent do
|
107
|
-
insist {message_observer.messages.size} == 1
|
108
|
-
insist {message_observer.messages[0].subject} == "Hello World"
|
109
|
-
insist {message_observer.messages[0].body.raw_source} == "Line1\r\nLine2\r\nLine3"
|
110
|
-
end
|
35
|
+
it "multiple *to* addresses in a field" do
|
36
|
+
subject = plugin.new("to" => "%{to_addr}",
|
37
|
+
"match" => ["mymatch", "dummy_match,ok"],
|
38
|
+
"options" => ["port", port])
|
39
|
+
subject.register
|
40
|
+
subject.receive(LogStash::Event.new("message" => "hello",
|
41
|
+
"dummy_match" => "ok",
|
42
|
+
"to_addr" => ["email1@host", "email2@host"]))
|
43
|
+
expect(message_observer.messages.size).to eq(1)
|
44
|
+
expect(message_observer.messages[0].to).to eq(["email1@host", "email2@host"])
|
111
45
|
end
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
}
|
127
|
-
output{
|
128
|
-
email {
|
129
|
-
to => "me@host"
|
130
|
-
subject => "Hello World"
|
131
|
-
body => "Line1\\nLine2\\nLine3"
|
132
|
-
match => ["mymatch", "dummy_match,*"]
|
133
|
-
options => ["port", #{port}, "authenticationType", "nil"]
|
134
|
-
}
|
135
|
-
}
|
136
|
-
CONFIG
|
137
|
-
|
138
|
-
agent do
|
139
|
-
insist {message_observer.messages.size} == 1
|
140
|
-
insist {message_observer.messages[0].subject} == "Hello World"
|
141
|
-
insist {message_observer.messages[0].body.raw_source} == "Line1\r\nLine2\r\nLine3"
|
142
|
-
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "multi-lined text body (LOGSTASH-841)" do
|
49
|
+
it "handles multiline messages" do
|
50
|
+
subject = plugin.new("to" => "me@host",
|
51
|
+
"subject" => "Hello World",
|
52
|
+
"body" => "Line1\\nLine2\\nLine3",
|
53
|
+
"match" => ["mymatch", "dummy_match,*"],
|
54
|
+
"options" => ["port", port])
|
55
|
+
subject.register
|
56
|
+
subject.receive(LogStash::Event.new("message" => "hello", "dummy_match" => "ok"))
|
57
|
+
expect(message_observer.messages.size).to eq(1)
|
58
|
+
expect(message_observer.messages[0].subject).to eq("Hello World")
|
59
|
+
expect(message_observer.messages[0].body.raw_source).to eq("Line1\r\nLine2\r\nLine3")
|
143
60
|
end
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "use nil authenticationType (LOGSTASH-559)" do
|
64
|
+
it "reads messages correctly" do
|
65
|
+
subject = plugin.new("to" => "me@host",
|
66
|
+
"subject" => "Hello World",
|
67
|
+
"body" => "Line1\\nLine2\\nLine3",
|
68
|
+
"match" => ["mymatch", "dummy_match,*"],
|
69
|
+
"options" => ["port", port, "authenticationType", "nil"])
|
70
|
+
subject.register
|
71
|
+
subject.receive(LogStash::Event.new("message" => "hello", "dummy_match" => "ok"))
|
72
|
+
expect(message_observer.messages.size).to eq(1)
|
73
|
+
expect(message_observer.messages[0].subject).to eq("Hello World")
|
74
|
+
expect(message_observer.messages[0].body.raw_source).to eq("Line1\r\nLine2\r\nLine3")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "match on source and message (LOGSTASH-826)" do
|
79
|
+
it "reads messages correctly" do
|
80
|
+
subject = plugin.new("to" => "me@host",
|
81
|
+
"subject" => "Hello World",
|
82
|
+
"body" => "Mail body",
|
83
|
+
"match" => [ "messageAndSourceMatch", "message,*hello,,and,type,*generator"],
|
84
|
+
"options" => ["port", port, "authenticationType", "nil"])
|
85
|
+
subject.register
|
86
|
+
subject.receive(LogStash::Event.new("message" => "hello world", "type" => "generator"))
|
87
|
+
expect(message_observer.messages.size).to eq(1)
|
88
|
+
expect(message_observer.messages[0].subject).to eq("Hello World")
|
89
|
+
expect(message_observer.messages[0].body.raw_source).to eq("Mail body")
|
170
90
|
end
|
91
|
+
end
|
171
92
|
end
|
172
93
|
|
173
94
|
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "logstash/devutils/rspec/spec_helper"
|
2
|
+
|
3
|
+
# use a dummy NOOP filter to test Filters::Base
|
4
|
+
class LogStash::Filters::NOOP < LogStash::Filters::Base
|
5
|
+
config_name "noop"
|
6
|
+
milestone 2
|
7
|
+
|
8
|
+
def register; end
|
9
|
+
|
10
|
+
def filter(event)
|
11
|
+
return unless filter?(event)
|
12
|
+
filter_matched(event)
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elasticsearch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
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-input-generator
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
75
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
|
76
90
|
email: info@elasticsearch.com
|
77
91
|
executables: []
|
@@ -87,6 +101,7 @@ files:
|
|
87
101
|
- lib/logstash/outputs/email.rb
|
88
102
|
- logstash-output-email.gemspec
|
89
103
|
- spec/outputs/email_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
90
105
|
homepage: http://www.elasticsearch.org/guide/en/logstash/current/index.html
|
91
106
|
licenses:
|
92
107
|
- Apache License (2.0)
|
@@ -115,3 +130,4 @@ specification_version: 4
|
|
115
130
|
summary: Send email when an output is received.
|
116
131
|
test_files:
|
117
132
|
- spec/outputs/email_spec.rb
|
133
|
+
- spec/spec_helper.rb
|