fluent-plugin-td 0.10.21 → 0.10.22
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 +8 -0
- data/README.rdoc +83 -1
- data/fluent-plugin-td.gemspec +3 -2
- data/lib/fluent/plugin/out_tditem.rb +2 -1
- data/lib/fluent/plugin/out_tdlog.rb +10 -4
- data/lib/fluent/plugin/td_plugin_util.rb +1 -1
- data/lib/fluent/plugin/td_plugin_version.rb +5 -0
- data/test/plugin/test_out_tdlog.rb +16 -0
- metadata +5 -5
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e4943818798256c0ec07e3db957ccd6edeb0de9
|
4
|
+
data.tar.gz: 50ca2274ebc97ad068189ca892fde5d7676d23af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e450f1c6f593bf2a16607d07ed3d378cdb1f29c3b5e4f8058a319ae814f385b40692151b8e6a26344307f257baf310240421fa536885a78a90725a2a7fa407
|
7
|
+
data.tar.gz: 97abcbc88c894038e0f137c689030dffcae5d4a680560f382fe24a77177cfd709d9cbd44893c3f330389bbd30ffe0e973b0f0210c92c97fc1b878d542e1e45cd
|
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
Release 0.10.22 - 2014/10/17
|
2
|
+
|
3
|
+
* Remove :time key from a record
|
4
|
+
* Show deperecated warning for <anonymize>
|
5
|
+
* Use Error#inspect to get error class in error log
|
6
|
+
* Update td-client to v0.8.66
|
7
|
+
|
8
|
+
|
1
9
|
Release 0.10.21 - 2014/07/04
|
2
10
|
|
3
11
|
* Use Yajl for summarizing json
|
data/README.rdoc
CHANGED
@@ -1,6 +1,88 @@
|
|
1
1
|
= Treasure Data output plugin for Fluentd
|
2
2
|
|
3
|
-
This plugin is used to upload logs to Treasure Data using
|
3
|
+
This Fluentd output plugin is used to upload logs to Treasure Data using
|
4
|
+
Treasure Data's REST APIs.
|
5
|
+
|
6
|
+
This plugin relies on the Treasure Data's {Ruby client library}[https://github.com/treasure-data/td-client-ruby] to communicate with the Treasure Data's REST APIs.
|
7
|
+
|
8
|
+
For more information, please visit the official {Fluentd TD Output plugin}[http://docs.fluentd.org/articles/http-to-td] page at http://docs.fluentd.org.
|
9
|
+
|
10
|
+
== Configuration
|
11
|
+
|
12
|
+
Please refer to the +example.conf+ example configuration file contained in the
|
13
|
+
root of this repository for some examples. The configuration file allows the user to specify various settings for this output plugin.
|
14
|
+
|
15
|
+
The configuration options currently supported are:
|
16
|
+
|
17
|
+
+apikey+::
|
18
|
+
Sets the configuration parameter to specify the Treasure Data API key.
|
19
|
+
|
20
|
+
Requires the API key as argument.
|
21
|
+
|
22
|
+
This parameter is *required*.
|
23
|
+
|
24
|
+
+auto_create_table+::
|
25
|
+
Specifies whether to create a database and/or table if the destination
|
26
|
+
database and/or table do not exist.
|
27
|
+
|
28
|
+
Requires no argument to enable; one optional boolean (true or false) argument accepted.
|
29
|
+
When this option is enabled, the destination database and table will be
|
30
|
+
determined based on the *event* *tag*: e.g. an even with tag 'td.mydb.mytable'
|
31
|
+
will require the plugin to upload data to the 'mydb' database and 'mytable'
|
32
|
+
table within it.
|
33
|
+
|
34
|
+
If this option is not used or set to false, the user is *required* to specify
|
35
|
+
the +database+ and +table+ configuration parameters as explained below.
|
36
|
+
|
37
|
+
*NOTE*
|
38
|
+
|
39
|
+
depending on the access control permissions associated to the API key, a database can or cannot be created if not already available.
|
40
|
+
See the {Treasure Data Access Control documentation}[http://docs.treasuredata.com/articles/access-control] page for details.
|
41
|
+
|
42
|
+
+database+::
|
43
|
+
Specifies the destination database in the Treasure Data cloud.
|
44
|
+
|
45
|
+
Requires the database name as argument.
|
46
|
+
|
47
|
+
This parameter is *required* unless the +auto_create_table+ option is used.
|
48
|
+
|
49
|
+
+table+::
|
50
|
+
Specifies the destination table in the above mentioned database within the Treasure Data cloud.
|
51
|
+
|
52
|
+
Requires the table name as argument.
|
53
|
+
|
54
|
+
This parameter is *required* unless the +auto_create_table+ option is used.
|
55
|
+
|
56
|
+
+endpoint+::
|
57
|
+
Specifies the Treasure Data's REST API endpoint.
|
58
|
+
|
59
|
+
Requires the endpoint as argument.
|
60
|
+
|
61
|
+
If not specified, a default is used; please refer to the {td-client-ruby's :endpoint}[https://github.com/treasure-data/td-client-ruby#endpoint] option for more details.
|
62
|
+
|
63
|
+
+use_ssl+::
|
64
|
+
Specifies whether to communicate using SSL encryption over HTTPS.
|
65
|
+
|
66
|
+
Requires no argument to enable; one optional boolean (true or false) argument accepted.
|
67
|
+
|
68
|
+
This option corresponds to {td-client-ruby's :ssl}[https://github.com/treasure-data/td-client-ruby#ssl] option: please refer to that page for important information concerning it.
|
69
|
+
|
70
|
+
+http_proxy+::
|
71
|
+
If communication with the Treasure Data API endpoint has to occur through a proxy, you can use this option to configure it.
|
72
|
+
|
73
|
+
Requires the proxy URL as argument. Please refer to the {td-client-ruby's :http_proxy}[https://github.com/treasure-data/td-client-ruby#proxy] option for details.
|
74
|
+
|
75
|
+
+connect_timeout+ +read_timeout+ +send_timeout+::
|
76
|
+
All three options specify the timeout used for every connection, when reading data from the Treasure Data API endpoints, and when sending data to it.
|
77
|
+
|
78
|
+
They require the number of seconds for the timeout as argument.
|
79
|
+
|
80
|
+
Please refer to the {td-client-ruby's :connect_timeout, :read_timeout, :send_timeout}[https://github.com/treasure-data/td-client-ruby#connection-read-and-send-timeouts] options for details.
|
81
|
+
|
82
|
+
+tmpdir+::
|
83
|
+
Specifies the temporary folder to use for storing the temporarily converted and compressed inputs.
|
84
|
+
|
85
|
+
Requires the path to the temporary folder as argument. If not specified, the system default as specified by Ruby's +Dir.tmpdir+ is used (the +TMPDIR+ environment variable is honored).
|
4
86
|
|
5
87
|
== Copyright
|
6
88
|
|
data/fluent-plugin-td.gemspec
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'fluent/plugin/td_plugin_version'
|
3
4
|
|
4
5
|
Gem::Specification.new do |gem|
|
5
6
|
gem.name = "fluent-plugin-td"
|
6
7
|
gem.description = "Treasure Data Cloud Data Service plugin for Fluentd"
|
7
8
|
gem.homepage = "http://www.treasuredata.com/"
|
8
9
|
gem.summary = gem.description
|
9
|
-
gem.version =
|
10
|
+
gem.version = Fluent::TreasureDataPlugin::VERSION
|
10
11
|
gem.authors = ["Treasure Data, Inc."]
|
11
12
|
gem.email = "support@treasure-data.com"
|
12
13
|
gem.has_rdoc = false
|
@@ -17,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
17
18
|
gem.require_paths = ['lib']
|
18
19
|
|
19
20
|
gem.add_dependency "fluentd", "~> 0.10.27"
|
20
|
-
gem.add_dependency "td-client", "~> 0.8.
|
21
|
+
gem.add_dependency "td-client", "~> 0.8.66"
|
21
22
|
gem.add_development_dependency "rake", ">= 0.9.2"
|
22
23
|
gem.add_development_dependency "webmock", "~> 1.16"
|
23
24
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'td-client'
|
2
|
+
require 'fluent/plugin/td_plugin_version'
|
2
3
|
|
3
4
|
module Fluent
|
4
5
|
class TreasureDataItemOutput < BufferedOutput
|
@@ -37,7 +38,7 @@ module Fluent
|
|
37
38
|
@key_num_limit = 1024 # Item table default limitation
|
38
39
|
@record_size_limit = 32 * 1024 * 1024 # TODO
|
39
40
|
@empty_gz_data = TreasureData::API.create_empty_gz_data
|
40
|
-
@user_agent = "fluent-plugin-td-item:
|
41
|
+
@user_agent = "fluent-plugin-td-item: #{TreasureDataPlugin::VERSION}".freeze
|
41
42
|
end
|
42
43
|
|
43
44
|
def configure(conf)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'td-client'
|
2
|
+
require 'fluent/plugin/td_plugin_version'
|
2
3
|
|
3
4
|
module Fluent
|
4
5
|
class TreasureDataLogOutput < BufferedOutput
|
@@ -93,6 +94,7 @@ module Fluent
|
|
93
94
|
@auto_create_table = true
|
94
95
|
@use_ssl = true
|
95
96
|
@empty_gz_data = TreasureData::API.create_empty_gz_data
|
97
|
+
@user_agent = "fluent-plugin-td: #{TreasureDataPlugin::VERSION}".freeze
|
96
98
|
end
|
97
99
|
|
98
100
|
def configure(conf)
|
@@ -162,10 +164,13 @@ module Fluent
|
|
162
164
|
|
163
165
|
@anonymizes[key] = scr
|
164
166
|
}
|
165
|
-
|
167
|
+
if @anonymizes.empty?
|
168
|
+
@anonymizes = nil
|
169
|
+
else
|
170
|
+
log.warn "<anonymize> feature is deprecated and will be removed. Use fluent-plugin-anonymizer instead."
|
171
|
+
end
|
166
172
|
|
167
173
|
@http_proxy = conf['http_proxy']
|
168
|
-
@user_agent = "fluent-plugin-td: 0.10.21" # TODO: automatic increment version
|
169
174
|
end
|
170
175
|
|
171
176
|
def start
|
@@ -218,6 +223,7 @@ module Fluent
|
|
218
223
|
end
|
219
224
|
|
220
225
|
record['time'] = time
|
226
|
+
record.delete(:time) if record.has_key?(:time)
|
221
227
|
|
222
228
|
if record.size > @key_num_limit
|
223
229
|
raise "Too many number of keys (#{record.size} keys)" # TODO include summary of the record
|
@@ -297,7 +303,7 @@ module Fluent
|
|
297
303
|
end
|
298
304
|
rescue => e
|
299
305
|
elapsed = Time.now - start
|
300
|
-
ne = RuntimeError.new("Failed to upload to Treasure Data '#{database}.#{table}' table: #{
|
306
|
+
ne = RuntimeError.new("Failed to upload to Treasure Data '#{database}.#{table}' table: #{e.inspect} (#{size} bytes; #{elapsed} seconds)")
|
301
307
|
ne.set_backtrace(e.backtrace)
|
302
308
|
raise ne
|
303
309
|
end
|
@@ -314,7 +320,7 @@ module Fluent
|
|
314
320
|
rescue TreasureData::NotFoundError
|
315
321
|
raise "Table #{key.inspect} does not exist on Treasure Data. Use 'td table:create #{database} #{table}' to create it."
|
316
322
|
rescue => e
|
317
|
-
log.warn "failed to check existence of '#{database}.#{table}' table on Treasure Data", :error => e.
|
323
|
+
log.warn "failed to check existence of '#{database}.#{table}' table on Treasure Data", :error => e.inspect
|
318
324
|
log.debug_backtrace e.backtrace
|
319
325
|
end
|
320
326
|
end
|
@@ -53,7 +53,7 @@ module Fluent
|
|
53
53
|
args = self.class == TreasureDataItemOutput ? ' -t item' : ''
|
54
54
|
raise "Table #{key.inspect} does not exist on Treasure Data. Use 'td table:create #{database} #{table}#{args}' to create it."
|
55
55
|
rescue => e
|
56
|
-
log.warn "failed to check table existence on Treasure Data", :error => e.
|
56
|
+
log.warn "failed to check table existence on Treasure Data", :error => e.inspect
|
57
57
|
log.debug_backtrace e
|
58
58
|
end
|
59
59
|
end
|
@@ -56,6 +56,22 @@ class TreasureDataLogOutputTest < Test::Unit::TestCase
|
|
56
56
|
assert_equal('TD1 testkey', @auth_header)
|
57
57
|
end
|
58
58
|
|
59
|
+
def test_emit_with_time_symbole
|
60
|
+
d = create_driver
|
61
|
+
time, records = stub_seed_values
|
62
|
+
database, table = d.instance.instance_variable_get(:@key).split(".", 2)
|
63
|
+
stub_td_table_create_request(database, table)
|
64
|
+
stub_td_import_request(stub_request_body(records, time), database, table)
|
65
|
+
|
66
|
+
records.each { |record|
|
67
|
+
record[:time] = Time.now.to_i # emit removes this :time key
|
68
|
+
d.emit(record, time)
|
69
|
+
}
|
70
|
+
d.run
|
71
|
+
|
72
|
+
assert_equal('TD1 testkey', @auth_header)
|
73
|
+
end
|
74
|
+
|
59
75
|
def test_emit_with_endpoint
|
60
76
|
d = create_driver(DEFAULT_CONFIG + "endpoint foo.bar.baz")
|
61
77
|
opts = {:endpoint => 'foo.bar.baz'}
|
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.22
|
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: 2014-
|
11
|
+
date: 2014-10-17 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.66
|
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.66
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,12 +79,12 @@ files:
|
|
79
79
|
- Gemfile
|
80
80
|
- README.rdoc
|
81
81
|
- Rakefile
|
82
|
-
- VERSION
|
83
82
|
- example.conf
|
84
83
|
- fluent-plugin-td.gemspec
|
85
84
|
- lib/fluent/plugin/out_tditem.rb
|
86
85
|
- lib/fluent/plugin/out_tdlog.rb
|
87
86
|
- lib/fluent/plugin/td_plugin_util.rb
|
87
|
+
- lib/fluent/plugin/td_plugin_version.rb
|
88
88
|
- test/plugin/test_out_tditem.rb
|
89
89
|
- test/plugin/test_out_tdlog.rb
|
90
90
|
- test/test_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.10.21
|