fluent-plugin-grassland 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-grassland.gemspec +1 -1
- data/lib/fluent/plugin/out_grassland.rb +23 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a58e5705d031e2680d0e20166851d5837aea29de2e0f635700b1b42315849c0
|
4
|
+
data.tar.gz: 925f4f26f5d36c91d06a3f08eb0994a0992a1fb2548af1c5ebc7677c9a0d1cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f376fe29cdc9881dd025c545d98532b05596143841dd28175d514e626d34fe4625569cf5fb68b6cb0bfe450da29a69978c42fca00ff2fbfb65131aeede340eff
|
7
|
+
data.tar.gz: 5e5484eaa1b00cd6d09dd025062e885f78760355946f8f3981f80bffa0491191153af97fff4660d230444cc12297e3b3e3660896bd6cd1c9897ead98928271ca
|
@@ -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-grassland'
|
7
|
-
spec.version = '0.2.
|
7
|
+
spec.version = '0.2.1'
|
8
8
|
spec.authors = ['Ripplation Inc.']
|
9
9
|
# spec.email = ['xxxxxx@ripplation.co.jp']
|
10
10
|
spec.description = 'Output filter plugin for Grassland'
|
@@ -1,6 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'syslog/logger'
|
2
|
+
require 'fluent/plugin/output'
|
3
|
+
|
4
|
+
module Fluent::Plugin
|
5
|
+
class GrasslandOutput < Fluent::Plugin::Output
|
6
|
+
Fluent::Plugin.register_output("grassland", self)
|
4
7
|
|
5
8
|
attr_accessor :random
|
6
9
|
attr_accessor :kinesis
|
@@ -16,6 +19,10 @@ module Fluent
|
|
16
19
|
require 'net/http'
|
17
20
|
require 'uri'
|
18
21
|
@random = Random.new
|
22
|
+
|
23
|
+
log = Syslog::Logger.new 'grasslandplugin'
|
24
|
+
log.info 'grassland initialize'
|
25
|
+
# puts "grassland initialize"
|
19
26
|
end
|
20
27
|
|
21
28
|
config_param :apiuri, :string, :default => 'https://grassland.biz/credentials'
|
@@ -60,14 +67,14 @@ module Fluent
|
|
60
67
|
begin
|
61
68
|
setCredential
|
62
69
|
configure_aws
|
63
|
-
@kinesis.
|
70
|
+
@kinesis.put_record({
|
64
71
|
:stream_name => @stream_name,
|
65
72
|
:data => "test",
|
66
73
|
:partition_key => "#{random.rand(999)}"
|
67
74
|
})
|
68
|
-
|
75
|
+
log.info "grassland: reset credential"
|
69
76
|
rescue => e
|
70
|
-
|
77
|
+
log.info [e.class, e].join(" : initialize error.")
|
71
78
|
end
|
72
79
|
end
|
73
80
|
|
@@ -100,11 +107,11 @@ module Fluent
|
|
100
107
|
warn "redirected to #{location}"
|
101
108
|
get_json(location, limit - 1)
|
102
109
|
else
|
103
|
-
|
110
|
+
log.info [uri.to_s, response.value].join(" : ")
|
104
111
|
# handle error
|
105
112
|
end
|
106
113
|
rescue => e
|
107
|
-
|
114
|
+
log.info [uri.to_s, e.class, e].join(" : ")
|
108
115
|
# handle error
|
109
116
|
end
|
110
117
|
end
|
@@ -113,7 +120,7 @@ module Fluent
|
|
113
120
|
# print(record)
|
114
121
|
['dt', 'd'].each do |key|
|
115
122
|
unless record.has_key?(key)
|
116
|
-
|
123
|
+
log.info "input data error: '#{key}' is required"
|
117
124
|
return ""
|
118
125
|
end
|
119
126
|
end
|
@@ -139,13 +146,15 @@ module Fluent
|
|
139
146
|
|
140
147
|
begin
|
141
148
|
dataList.each do |data|
|
149
|
+
# debug log
|
150
|
+
# log.info data.to_json
|
142
151
|
if bufList[":#{data['pk']}"] == nil then
|
143
152
|
bufList[":#{data['pk']}"] = "#{data.to_json},"
|
144
153
|
else
|
145
154
|
bufList[":#{data['pk']}"] += "#{data.to_json},"
|
146
155
|
end
|
147
156
|
if bufList[":#{data['pk']}"].bytesize >= 30720 then
|
148
|
-
@kinesis.
|
157
|
+
@kinesis.put_record({
|
149
158
|
:stream_name => @stream_name,
|
150
159
|
:data => "["+bufList[":#{data['pk']}"].chop+"]",
|
151
160
|
:partition_key => partitionKeys[random.rand(partitionKeys.length)]
|
@@ -156,7 +165,7 @@ module Fluent
|
|
156
165
|
end
|
157
166
|
dataList.each do |data|
|
158
167
|
if bufList[":#{data['pk']}"] != nil then
|
159
|
-
@kinesis.
|
168
|
+
@kinesis.put_record({
|
160
169
|
:stream_name => @stream_name,
|
161
170
|
:data => "["+bufList[":#{data['pk']}"].chop+"]",
|
162
171
|
:partition_key => partitionKeys[random.rand(partitionKeys.length)]
|
@@ -166,7 +175,7 @@ module Fluent
|
|
166
175
|
end
|
167
176
|
end
|
168
177
|
rescue
|
169
|
-
|
178
|
+
log.info "error: put_record to grassland. maybe too many requests. few data dropped."
|
170
179
|
end
|
171
180
|
end
|
172
181
|
|
@@ -188,8 +197,7 @@ module Fluent
|
|
188
197
|
)
|
189
198
|
end
|
190
199
|
|
191
|
-
@kinesis =
|
192
|
-
# AWS.config(options)
|
200
|
+
@kinesis = Aws::Kinesis::Client.new(options)
|
193
201
|
end
|
194
202
|
end
|
195
|
-
end
|
203
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-grassland
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ripplation Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.0.3
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Output filter plugin for Grassland
|