fluent-plugin-td 0.10.15 → 0.10.16
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/ChangeLog +7 -0
- data/VERSION +1 -1
- data/fluent-plugin-td.gemspec +1 -1
- data/lib/fluent/plugin/out_tdlog.rb +46 -27
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 313c5a37b90313d1a1e805285da719c35951184b
|
4
|
+
data.tar.gz: c0f9975f641434550a2d18a9374bb84fc117b37f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 912b12246d9650b39137bb1ebd098b45ef9d6ecb4460c8a4667bf1daaaa40ec58ee5a5479a5d7a580b709a5aa5ecfd4b258f5394fbf47b98d1fff709f5d839c0
|
7
|
+
data.tar.gz: 6d7ac160d26c13d97c49930cb8b9fd045f3a04bfac1a05066ff05877ecf12a82e5562b3a37c7da0acc3c39f6649bedc1b8aecdff984a2fd4df3d9b528b62179c
|
data/ChangeLog
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
Release 0.10.16 - 2013/09/25
|
2
|
+
|
3
|
+
* Add connect_timeout / read_timeout / send_timeout parameters
|
4
|
+
* Create table when 'database' and 'table' are specified with 'auto_create_table true'
|
5
|
+
* Update td-client to v0.8.55
|
6
|
+
|
7
|
+
|
1
8
|
Release 0.10.15 - 2013/07/26
|
2
9
|
|
3
10
|
* Add user-agent header to upload request
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.16
|
data/fluent-plugin-td.gemspec
CHANGED
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
|
19
19
|
gem.add_dependency "fluentd", "~> 0.10.27"
|
20
|
-
gem.add_dependency "td-client", "~> 0.8.
|
20
|
+
gem.add_dependency "td-client", "~> 0.8.55"
|
21
21
|
gem.add_development_dependency "rake", ">= 0.9.2"
|
22
22
|
end
|
@@ -60,6 +60,10 @@ class TreasureDataLogOutput < BufferedOutput
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
config_param :connect_timeout, :integer, :default => nil
|
64
|
+
config_param :read_timeout, :integer, :default => nil
|
65
|
+
config_param :send_timeout, :integer, :default => nil
|
66
|
+
|
63
67
|
def initialize
|
64
68
|
require 'fileutils'
|
65
69
|
require 'tempfile'
|
@@ -123,24 +127,13 @@ class TreasureDataLogOutput < BufferedOutput
|
|
123
127
|
end
|
124
128
|
end
|
125
129
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
if !database || !table
|
131
|
-
raise ConfigError, "'database' and 'table' parameter are required on tdlog output"
|
132
|
-
end
|
133
|
-
begin
|
134
|
-
TreasureData::API.validate_database_name(database)
|
135
|
-
rescue
|
136
|
-
raise ConfigError, "Invalid database name #{database.inspect}: #{$!}: #{conf}"
|
137
|
-
end
|
138
|
-
begin
|
139
|
-
TreasureData::API.validate_table_name(table)
|
140
|
-
rescue
|
141
|
-
raise ConfigError, "Invalid table name #{table.inspect}: #{$!}: #{conf}"
|
142
|
-
end
|
130
|
+
database = conf['database']
|
131
|
+
table = conf['table']
|
132
|
+
if database && table
|
133
|
+
validate_database_and_table_name(database, table, conf)
|
143
134
|
@key = "#{database}.#{table}"
|
135
|
+
else
|
136
|
+
raise ConfigError, "'database' and 'table' parameter are required on tdlog output without auto_create_table" unless @auto_create_table
|
144
137
|
end
|
145
138
|
|
146
139
|
@anonymizes = {}
|
@@ -171,9 +164,18 @@ class TreasureDataLogOutput < BufferedOutput
|
|
171
164
|
|
172
165
|
def start
|
173
166
|
super
|
174
|
-
|
175
|
-
|
176
|
-
|
167
|
+
|
168
|
+
@client = TreasureData::Client.new(@apikey, :ssl => @use_ssl, :http_proxy => @http_proxy, :user_agent => @user_agent,
|
169
|
+
:connect_timeout => @connect_timeout, :read_timeout => @read_timeout, :send_timeout => @send_timeout)
|
170
|
+
begin
|
171
|
+
check_table_exists(@key) if @key
|
172
|
+
rescue => e
|
173
|
+
if @auto_create_table
|
174
|
+
database, table = @key.split('.', 2)
|
175
|
+
ensure_database_and_table(database, table)
|
176
|
+
else
|
177
|
+
raise e
|
178
|
+
end
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
@@ -282,13 +284,7 @@ class TreasureDataLogOutput < BufferedOutput
|
|
282
284
|
unless @auto_create_table
|
283
285
|
raise $!
|
284
286
|
end
|
285
|
-
|
286
|
-
begin
|
287
|
-
@client.create_log_table(database, table)
|
288
|
-
rescue TreasureData::NotFoundError
|
289
|
-
@client.create_database(database)
|
290
|
-
@client.create_log_table(database, table)
|
291
|
-
end
|
287
|
+
ensure_database_and_table(database, table)
|
292
288
|
io.pos = 0
|
293
289
|
retry
|
294
290
|
end
|
@@ -325,6 +321,29 @@ class TreasureDataLogOutput < BufferedOutput
|
|
325
321
|
}
|
326
322
|
list
|
327
323
|
end
|
324
|
+
|
325
|
+
def validate_database_and_table_name(database, table, conf)
|
326
|
+
begin
|
327
|
+
TreasureData::API.validate_database_name(database)
|
328
|
+
rescue => e
|
329
|
+
raise ConfigError, "Invalid database name #{database.inspect}: #{e}: #{conf}"
|
330
|
+
end
|
331
|
+
begin
|
332
|
+
TreasureData::API.validate_table_name(table)
|
333
|
+
rescue => e
|
334
|
+
raise ConfigError, "Invalid table name #{table.inspect}: #{e}: #{conf}"
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def ensure_database_and_table(database, table)
|
339
|
+
$log.info "Creating table #{database}.#{table} on TreasureData"
|
340
|
+
begin
|
341
|
+
@client.create_log_table(database, table)
|
342
|
+
rescue TreasureData::NotFoundError
|
343
|
+
@client.create_database(database)
|
344
|
+
@client.create_log_table(database, table)
|
345
|
+
end
|
346
|
+
end
|
328
347
|
end
|
329
348
|
|
330
349
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Treasure Data, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.
|
33
|
+
version: 0.8.55
|
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
|
-
version: 0.8.
|
40
|
+
version: 0.8.55
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.0.
|
91
|
+
rubygems_version: 2.0.3
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Treasure Data Big Data as a Service plugin for Fluentd
|