fluent-plugin-idobata 0.0.2 → 0.0.3
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/README.md +2 -2
- data/fluent-plugin-idobata.gemspec +1 -1
- data/lib/fluent/plugin/out_idobata.rb +2 -1
- data/spec/lib/fluent/plugin/out_idobata_spec.rb +45 -19
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f6a7ed06f9351a5f84c458d6d7257ebea1a81a5
|
4
|
+
data.tar.gz: 05221ac8b43f5822a17abc109dbc5bbcdfe8b85b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efffca3ae696544c1a0ba19194933e943bda1986a7c38c9826473eb7e0459cdb8972fc3b9344195e6c9c38c3c380f1be0b5593e6c86efbff39190893a2d90d12
|
7
|
+
data.tar.gz: 083b67d66eac2f7c4fbbec3bdbd4094af3c8d34a947edd0cd66f73797b6dc0675f6d7e1033dfd931429a59144e522eb5dcdb73e4fbaa03c202f21fefee6ca9b9
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# fluent-plugin-idobata
|
1
|
+
# fluent-plugin-idobata, a plugin for [Fluentd](http://fluentd.org)
|
2
2
|
|
3
3
|
## Output
|
4
4
|
|
@@ -26,7 +26,7 @@ see: https://idobata.io
|
|
26
26
|
- You can use erb notation
|
27
27
|
- send message to idobata
|
28
28
|
- (optional)post_interval
|
29
|
-
-
|
29
|
+
- Interval of post to idobata
|
30
30
|
|
31
31
|
#### example
|
32
32
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-idobata"
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.3'
|
8
8
|
spec.authors = ["bash0C7"]
|
9
9
|
spec.email = ["koshiba+github@4038nullpointer.com"]
|
10
10
|
spec.description = "Fluentd output plugin to send data to idobata"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'erb'
|
3
3
|
require 'ostruct'
|
4
|
+
require 'cgi'
|
4
5
|
|
5
6
|
module Fluent
|
6
7
|
class Fluent::IdobataOutput < Fluent::Output
|
@@ -58,7 +59,7 @@ module Fluent
|
|
58
59
|
record = param.record
|
59
60
|
|
60
61
|
begin
|
61
|
-
HTTParty.post(@webhook_url, :body => "body=#{@erb.result(binding)}")
|
62
|
+
HTTParty.post(@webhook_url, :body => "body=#{CGI.escape(@erb.result(binding))}")
|
62
63
|
sleep(@post_interval)
|
63
64
|
rescue
|
64
65
|
$log.warn "raises exception: #{$!.class}, '#{$!.message}, #{param}'"
|
@@ -25,31 +25,57 @@ describe do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe 'emit' do
|
28
|
-
let(:record1) {{ 'field1' => 50, 'otherfield' => 99}}
|
29
|
-
let(:record2) {{ 'field1' => 150, 'otherfield' => 199}}
|
30
28
|
let(:time) {0}
|
31
|
-
|
32
|
-
|
29
|
+
context 'without semicolon in body' do
|
30
|
+
let(:record1) {{ 'field1' => 50, 'otherfield' => 99}}
|
31
|
+
let(:record2) {{ 'field1' => 150, 'otherfield' => 199}}
|
32
|
+
let(:posted) {
|
33
|
+
d = driver
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
expect(HTTParty).to receive(:post).with('https://idobata/web_hook/url', :body => "body=#{CGI.escape('field1 value: 50')}")
|
36
|
+
expect(HTTParty).to receive(:post).with('https://idobata/web_hook/url', :body => "body=#{CGI.escape('field1 value: 150')}")
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
d.emit(record1, Time.at(time))
|
39
|
+
d.emit(record2, Time.at(time))
|
40
|
+
d.run
|
41
|
+
}
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
context do
|
44
|
+
let(:config) {
|
45
|
+
%[
|
46
|
+
webhook_url https://idobata/web_hook/url
|
47
|
+
message_template field1 value: <%= record["field1"] %>
|
48
|
+
post_interval 0
|
49
|
+
]
|
50
|
+
}
|
51
|
+
|
52
|
+
subject {posted}
|
53
|
+
it{should_not be_nil}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
context 'without semicolon in body' do
|
57
|
+
let(:record1) {{ 'field1' => ';te;st;', 'otherfield' => 99}}
|
58
|
+
let(:posted) {
|
59
|
+
d = driver
|
60
|
+
|
61
|
+
expect(HTTParty).to receive(:post).with('https://idobata/web_hook/url', :body => "body=#{CGI.escape('field1 value: ;te;st;')}")
|
62
|
+
|
63
|
+
d.emit(record1, Time.at(time))
|
64
|
+
d.run
|
49
65
|
}
|
50
66
|
|
51
|
-
|
52
|
-
|
67
|
+
context do
|
68
|
+
let(:config) {
|
69
|
+
%[
|
70
|
+
webhook_url https://idobata/web_hook/url
|
71
|
+
message_template field1 value: <%= record["field1"] %>
|
72
|
+
post_interval 0
|
73
|
+
]
|
74
|
+
}
|
75
|
+
|
76
|
+
subject {posted}
|
77
|
+
it{should_not be_nil}
|
78
|
+
end
|
53
79
|
end
|
54
80
|
|
55
81
|
end
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-idobata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bash0C7
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: httparty
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.13'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rr
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Fluentd output plugin to send data to idobata
|
@@ -115,8 +115,8 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
-
|
119
|
-
-
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
120
|
- Gemfile
|
121
121
|
- README.md
|
122
122
|
- Rakefile
|
@@ -134,17 +134,17 @@ require_paths:
|
|
134
134
|
- lib
|
135
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - '>='
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- -
|
142
|
+
- - '>='
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.0.14
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Fluentd output plugin to send data to idobata
|