fluent-plugin-mail 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -1
- data/fluent-plugin-mail.gemspec +1 -1
- data/lib/fluent/plugin/out_mail.rb +25 -2
- data/test/plugin/test_out_mail.rb +16 -0
- metadata +14 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 08ceecd16cc939b91f13583cddc06d5c28a20b44
|
4
|
+
data.tar.gz: 7e0ad279c8f9496e142dc6a7e188a91882dce0d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a551babe539ec1c50402f7493ef1f6b665f1746391ab7cf4e02d5927726dd0fc004dd37751b6bfd399598b071d2017864062e5f19bb3752a33b0e0cc8c580e98
|
7
|
+
data.tar.gz: aeb29d542110009b5649596a95cc04d209b613e896dab30a0c11cccae6802325c4a40ce7b3770b8cdf95ce84726e6958537f0f5f1452163abd62d64af6b06d39
|
data/README.md
CHANGED
@@ -82,6 +82,7 @@ Email is sent like
|
|
82
82
|
password PASSWORD
|
83
83
|
enable_starttls_auto true
|
84
84
|
out_keys target_tag,pattern,value
|
85
|
+
time_locale UTC # optional
|
85
86
|
</match>
|
86
87
|
|
87
88
|
|
@@ -126,7 +127,7 @@ configure td-agent.conf for single node
|
|
126
127
|
from SOURCE_MAIL_ADDRESS
|
127
128
|
to DESTINATION_MAIL_ADDRESS
|
128
129
|
subject SUBJECT
|
129
|
-
|
130
|
+
out_keys target_tag, pattern, value, message_time
|
130
131
|
</match>
|
131
132
|
|
132
133
|
|
@@ -189,6 +190,7 @@ log server("/etc/td-agent/td-agent.conf")
|
|
189
190
|
to DESTINATION_MAIL_ADDRESS
|
190
191
|
subject SUBJECT
|
191
192
|
outkeys target_tag, pattern, value
|
193
|
+
time_locale UTC # optional
|
192
194
|
</match>
|
193
195
|
|
194
196
|
|
data/fluent-plugin-mail.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "fluent-plugin-mail"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = '0.0.
|
15
|
+
gem.version = '0.0.3'
|
16
16
|
gem.add_development_dependency "fluentd"
|
17
17
|
gem.add_development_dependency "rake"
|
18
18
|
gem.add_runtime_dependency "fluentd"
|
@@ -14,9 +14,12 @@ class Fluent::MailOutput < Fluent::Output
|
|
14
14
|
config_param :password, :string, :default => nil
|
15
15
|
config_param :from, :string, :default => 'localhost@localdomain'
|
16
16
|
config_param :to, :string, :default => ''
|
17
|
+
config_param :cc, :string, :default => ''
|
18
|
+
config_param :bcc, :string, :default => ''
|
17
19
|
config_param :subject, :string, :default => 'Fluent::MailOutput plugin'
|
18
20
|
config_param :subject_out_keys, :string, :default => ""
|
19
21
|
config_param :enable_starttls_auto, :bool, :default => false
|
22
|
+
config_param :time_locale, :default => nil
|
20
23
|
|
21
24
|
def initialize
|
22
25
|
super
|
@@ -161,10 +164,18 @@ class Fluent::MailOutput < Fluent::Output
|
|
161
164
|
subject = subject.force_encoding('binary')
|
162
165
|
body = msg.force_encoding('binary')
|
163
166
|
|
164
|
-
|
165
|
-
|
167
|
+
if time_local
|
168
|
+
date = Time::now.timezone(time_local)
|
169
|
+
else
|
170
|
+
date = Time::now
|
171
|
+
end
|
172
|
+
|
173
|
+
smtp.send_mail(<<EOS, @from, @to.split(/,/), @cc.split(/,/), @bcc.split(/,/))
|
174
|
+
Date: #{date.strftime("%a, %d %b %Y %X %z")}
|
166
175
|
From: #{@from}
|
167
176
|
To: #{@to}
|
177
|
+
Cc: #{@cc}
|
178
|
+
Bcc: #{@bcc}
|
168
179
|
Subject: #{subject}
|
169
180
|
Mime-Version: 1.0
|
170
181
|
Content-Type: text/plain; charset=utf-8
|
@@ -176,3 +187,15 @@ EOS
|
|
176
187
|
|
177
188
|
end
|
178
189
|
|
190
|
+
class Time
|
191
|
+
def timezone(timezone = 'UTC')
|
192
|
+
old = ENV['TZ']
|
193
|
+
utc = self.dup.utc
|
194
|
+
ENV['TZ'] = timezone
|
195
|
+
output = utc.localtime
|
196
|
+
ENV['TZ'] = old
|
197
|
+
output
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
|
@@ -15,6 +15,20 @@ class MailOutputTest < Test::Unit::TestCase
|
|
15
15
|
to localhost@localdomain
|
16
16
|
]
|
17
17
|
|
18
|
+
CONFIG_CC_BCC = %[
|
19
|
+
out_keys tag,time,value
|
20
|
+
time_key time
|
21
|
+
time_format %Y/%m/%d %H:%M:%S
|
22
|
+
tag_key tag
|
23
|
+
subject Fluentd Notification Alarm %s
|
24
|
+
subject_out_keys tag
|
25
|
+
host localhost
|
26
|
+
port 25
|
27
|
+
from localhost@localdomain
|
28
|
+
cc localhost@localdomain
|
29
|
+
bcc localhost@localdomain
|
30
|
+
]
|
31
|
+
|
18
32
|
CONFIG_MESSAGE = %[
|
19
33
|
message out_mail: %s [%s]\\n%s
|
20
34
|
message_out_keys tag,time,value
|
@@ -36,6 +50,8 @@ class MailOutputTest < Test::Unit::TestCase
|
|
36
50
|
def test_configure
|
37
51
|
d = create_driver(CONFIG_OUT_KEYS)
|
38
52
|
assert_equal 'localhost', d.instance.host
|
53
|
+
d = create_driver(CONFIG_CC_BCC)
|
54
|
+
assert_equal 'localhost', d.instance.host
|
39
55
|
d = create_driver(CONFIG_MESSAGE)
|
40
56
|
assert_equal 'localhost', d.instance.host
|
41
57
|
end
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Yuichi UEMURA
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: fluentd
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: fluentd
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: output plugin for Mail
|
@@ -66,7 +59,7 @@ executables: []
|
|
66
59
|
extensions: []
|
67
60
|
extra_rdoc_files: []
|
68
61
|
files:
|
69
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
70
63
|
- Gemfile
|
71
64
|
- LICENSE
|
72
65
|
- README.md
|
@@ -77,27 +70,26 @@ files:
|
|
77
70
|
- test/plugin/test_out_mail.rb
|
78
71
|
homepage: https://github.com/u-ichi/fluent-plugin-mail
|
79
72
|
licenses: []
|
73
|
+
metadata: {}
|
80
74
|
post_install_message:
|
81
75
|
rdoc_options: []
|
82
76
|
require_paths:
|
83
77
|
- lib
|
84
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
79
|
requirements:
|
87
|
-
- -
|
80
|
+
- - ">="
|
88
81
|
- !ruby/object:Gem::Version
|
89
82
|
version: '0'
|
90
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
84
|
requirements:
|
93
|
-
- -
|
85
|
+
- - ">="
|
94
86
|
- !ruby/object:Gem::Version
|
95
87
|
version: '0'
|
96
88
|
requirements: []
|
97
89
|
rubyforge_project: fluent-plugin-mail
|
98
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 2.1.10
|
99
91
|
signing_key:
|
100
|
-
specification_version:
|
92
|
+
specification_version: 4
|
101
93
|
summary: output plugin for Mail
|
102
94
|
test_files:
|
103
95
|
- test/helper.rb
|