fluent-plugin-arango 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/AUTHORS +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +202 -0
- data/README.rdoc +138 -0
- data/Rakefile +12 -0
- data/VERSION +1 -0
- data/fluent-plugin-arango.gemspec +23 -0
- data/lib/fluent/plugin/out_arango.rb +74 -0
- data/test/plugin/out_arango.rb +123 -0
- metadata +104 -0
data/.gitignore
ADDED
data/AUTHORS
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.rdoc
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
= ArangoDB plugin for Fluentd
|
2
|
+
|
3
|
+
fluent-plugin-arango provides write to {ArangoDB}[http://www.arangodb.org/] for {Fluentd}[http://fluentd.org/].
|
4
|
+
|
5
|
+
= Install
|
6
|
+
|
7
|
+
$ fluent-gem install fluent-plugin-arango
|
8
|
+
|
9
|
+
= Configuration
|
10
|
+
|
11
|
+
== Minimum Configuration
|
12
|
+
|
13
|
+
<match access.**>
|
14
|
+
type arango
|
15
|
+
collection my_collection_name
|
16
|
+
</match>
|
17
|
+
|
18
|
+
== Supported Configurations
|
19
|
+
|
20
|
+
<match access.**>
|
21
|
+
|
22
|
+
# plugin type
|
23
|
+
type arango
|
24
|
+
|
25
|
+
# required
|
26
|
+
collection my_collection_name
|
27
|
+
|
28
|
+
# optional host-config
|
29
|
+
host localhost
|
30
|
+
port 8529
|
31
|
+
|
32
|
+
# optional auth-config
|
33
|
+
username xxxx
|
34
|
+
password xxxx
|
35
|
+
|
36
|
+
# optional time-config (provided by Fluent::SetTimeKeyMixin)
|
37
|
+
include_time_key true
|
38
|
+
time_key time
|
39
|
+
##time_format
|
40
|
+
##localtime
|
41
|
+
##utc
|
42
|
+
|
43
|
+
# optional tag-config (proviced by Fluent::SetTagKeyMixin)
|
44
|
+
include_tag_key true
|
45
|
+
tag_key tag
|
46
|
+
|
47
|
+
# optinal parent-class-config (proviced by Fluent::BufferedOutput)
|
48
|
+
buffer_type memory
|
49
|
+
flush_interval 60
|
50
|
+
retry_limit 17
|
51
|
+
retry_wait 1.0
|
52
|
+
num_threads 1
|
53
|
+
##<secondary>
|
54
|
+
##secondary_limit
|
55
|
+
|
56
|
+
</match>
|
57
|
+
|
58
|
+
= Examples
|
59
|
+
|
60
|
+
== Example: Basically Output
|
61
|
+
|
62
|
+
*Configure*
|
63
|
+
|
64
|
+
<match hoge>
|
65
|
+
type arango
|
66
|
+
collection fuga
|
67
|
+
</match>
|
68
|
+
|
69
|
+
*Result*
|
70
|
+
IN: {"a": 1}
|
71
|
+
OUT: {"a":1, "tag": "hoge", "time": "2013-02-18T12:59:10Z"}
|
72
|
+
|
73
|
+
|
74
|
+
== Example: Does not include a time,tag key
|
75
|
+
|
76
|
+
*Configure*
|
77
|
+
|
78
|
+
<match hoge>
|
79
|
+
type arango
|
80
|
+
collection fuga
|
81
|
+
include_time_key false
|
82
|
+
include_tag_key false
|
83
|
+
</match>
|
84
|
+
|
85
|
+
*Result*
|
86
|
+
IN: {"a": 1}
|
87
|
+
OUT: {"a":1}
|
88
|
+
|
89
|
+
== Example: Change time format, and Change time,tag key name
|
90
|
+
|
91
|
+
*Configure*
|
92
|
+
|
93
|
+
<match hoge>
|
94
|
+
type arango
|
95
|
+
collection fuga
|
96
|
+
time_format %Y/%m/%d %H:%M:%S
|
97
|
+
time_key mytime
|
98
|
+
tag_key mytag
|
99
|
+
</match>
|
100
|
+
|
101
|
+
*Result*
|
102
|
+
IN: {"a": 1}
|
103
|
+
OUT: {"a":1, "mytag": "hoge", "mytime": "2013/02/18 12:59:10"}
|
104
|
+
|
105
|
+
|
106
|
+
== Example: Connect to ArangoDB with authenticate
|
107
|
+
|
108
|
+
*Configure*
|
109
|
+
|
110
|
+
<match hoge>
|
111
|
+
type arango
|
112
|
+
collection fuga
|
113
|
+
username your_name
|
114
|
+
password your_pass
|
115
|
+
</match>
|
116
|
+
|
117
|
+
= Attention
|
118
|
+
|
119
|
+
time and tag is destructive operation.
|
120
|
+
( see: http://d.hatena.ne.jp/oranie/20120525/1337942598 )
|
121
|
+
|
122
|
+
= TODO
|
123
|
+
|
124
|
+
* Bulk import
|
125
|
+
* UnitTest for auth
|
126
|
+
|
127
|
+
= Dependency Library
|
128
|
+
|
129
|
+
* {ashikawa-core}[https://github.com/triAGENS/ashikawa-core/]
|
130
|
+
|
131
|
+
|
132
|
+
= Copyright and License
|
133
|
+
|
134
|
+
Copyright:: Copyright (c) 2013- tamtam180 <kirscheless _at_ gmail.com>
|
135
|
+
License:: Apache License, Version 2.0
|
136
|
+
|
137
|
+
|
138
|
+
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "fluent-plugin-arango"
|
7
|
+
gem.version = File.read("VERSION").strip
|
8
|
+
gem.authors = ["tamtam180"]
|
9
|
+
gem.email = ["kirscheless@gmail.com"]
|
10
|
+
gem.description = %q{ArangoDB plugin for Fluent event collector}
|
11
|
+
gem.summary = %q{ArangoDB plugin for Fluent event collector}
|
12
|
+
gem.homepage = ""
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($/)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_dependency "fluentd", "~> 0.10.0"
|
20
|
+
gem.add_dependency "ashikawa-core", "~> 0.5.1"
|
21
|
+
gem.add_development_dependency "rake", ">= 0.9.2"
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
class ArangoOutput < BufferedOutput
|
5
|
+
Fluent::Plugin.register_output('arango', self)
|
6
|
+
|
7
|
+
include Fluent::SetTagKeyMixin
|
8
|
+
config_set_default :include_tag_key, true
|
9
|
+
|
10
|
+
include Fluent::SetTimeKeyMixin
|
11
|
+
config_set_default :include_time_key, true
|
12
|
+
|
13
|
+
config_param :scheme, :string, :default => 'http'
|
14
|
+
config_param :host, :string, :default => 'localhost'
|
15
|
+
config_param :port, :integer, :default => 8529
|
16
|
+
config_param :collection, :string
|
17
|
+
config_param :username, :string, :default => nil
|
18
|
+
config_param :password, :string, :default => nil
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
super
|
22
|
+
require 'ashikawa-core'
|
23
|
+
require 'msgpack'
|
24
|
+
|
25
|
+
@db = nil
|
26
|
+
@conn = nil
|
27
|
+
@col = nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def configure(conf)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def start
|
36
|
+
super
|
37
|
+
|
38
|
+
@conn = Ashikawa::Core::Connection.new(get_arango_url)
|
39
|
+
if @username && @password then
|
40
|
+
@conn.authenticate_with(:username => @username, :password => @password)
|
41
|
+
end
|
42
|
+
@db = Ashikawa::Core::Database.new(@conn)
|
43
|
+
@col = @db[@collection]
|
44
|
+
end
|
45
|
+
|
46
|
+
def shutdown
|
47
|
+
# MEMO: Ashikawa-Core has not finalize-method.
|
48
|
+
super
|
49
|
+
end
|
50
|
+
|
51
|
+
def format(tag, time, record)
|
52
|
+
return record.to_msgpack
|
53
|
+
end
|
54
|
+
|
55
|
+
#def emit(tag, es, chain)
|
56
|
+
#end
|
57
|
+
|
58
|
+
def write(chunk)
|
59
|
+
# TODO: Change to bulk import if Ashikawa-core implemented.
|
60
|
+
chunk.msgpack_each do |record|
|
61
|
+
@col.create(record)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def get_arango_url
|
69
|
+
return "#{@scheme}://#{@host}:#{@port}"
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'fluent/test'
|
3
|
+
require 'ashikawa-core'
|
4
|
+
require 'msgpack'
|
5
|
+
|
6
|
+
class ArangoOutputTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
DEFAULT_COL = 'ut_col'
|
9
|
+
DEFAULT_HOST = 'localhost'
|
10
|
+
DEFAULT_PORT = 8529
|
11
|
+
CONFIG = %[
|
12
|
+
type arango
|
13
|
+
collection #{DEFAULT_COL}
|
14
|
+
host #{DEFAULT_HOST}
|
15
|
+
port #{DEFAULT_PORT}
|
16
|
+
]
|
17
|
+
ARANGO_URL = "http://#{DEFAULT_HOST}:#{DEFAULT_PORT}"
|
18
|
+
|
19
|
+
def setup
|
20
|
+
Fluent::Test.setup
|
21
|
+
# HACK: Avoid Error "Encoding::UndefinedConversionError: U+00FC from UTF-8 to ASCII-8BIT"
|
22
|
+
Encoding.default_internal = Encoding::UTF_8
|
23
|
+
require 'fluent/plugin/out_arango'
|
24
|
+
|
25
|
+
# TODO: AUTH case
|
26
|
+
# TODO: Start/Stop ArangoDB from Ruby-Script
|
27
|
+
|
28
|
+
# drop collection
|
29
|
+
@con = Ashikawa::Core::Connection.new(ARANGO_URL)
|
30
|
+
@db = Ashikawa::Core::Database.new(@con)
|
31
|
+
@col = @db[DEFAULT_COL]
|
32
|
+
@col.delete
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def teardown
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_driver(conf = CONFIG)
|
41
|
+
return Fluent::Test::BufferedOutputTestDriver.new(Fluent::ArangoOutput).configure(conf)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_configure_no_parameter
|
45
|
+
# assert_throws ..
|
46
|
+
begin
|
47
|
+
driver = create_driver(%[
|
48
|
+
type arango
|
49
|
+
])
|
50
|
+
flunk "fail"
|
51
|
+
rescue Fluent::ConfigError
|
52
|
+
assert_equal $!.message, "'collection' parameter is required"
|
53
|
+
rescue
|
54
|
+
flunk "fail"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_configure
|
59
|
+
d = create_driver(%[
|
60
|
+
type arango
|
61
|
+
collection ut_col
|
62
|
+
])
|
63
|
+
assert_equal 'ut_col', d.instance.collection
|
64
|
+
# default parameter
|
65
|
+
assert_equal 'http', d.instance.scheme
|
66
|
+
assert_equal 'localhost', d.instance.host
|
67
|
+
assert_equal 8529, d.instance.port
|
68
|
+
assert_equal nil, d.instance.username
|
69
|
+
assert_equal nil, d.instance.password
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_format
|
73
|
+
d = create_driver()
|
74
|
+
|
75
|
+
tag = "test"
|
76
|
+
time = Time.parse("2013-02-28 23:59:59 UTC").to_i # 1362095999
|
77
|
+
d.emit({"a" => 1}, time)
|
78
|
+
d.emit({"a" => 2}, time)
|
79
|
+
|
80
|
+
d.expect_format({"a" => 1, "tag" => tag, "time" => "2013-02-28T23:59:59Z"}.to_msgpack)
|
81
|
+
d.expect_format({"a" => 2, "tag" => tag, "time" => "2013-02-28T23:59:59Z"}.to_msgpack)
|
82
|
+
|
83
|
+
d.run
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_format_time
|
87
|
+
d = create_driver(CONFIG + %[
|
88
|
+
time_format %Y-%m-%d %H:%M:%S
|
89
|
+
time_key mytime
|
90
|
+
])
|
91
|
+
d.emit({"a" => 1}, Time.parse("2013-02-28 23:59:59 UTC").to_i)
|
92
|
+
|
93
|
+
d.expect_format({"a" => 1, "tag" => "test", "mytime" => "2013-02-28 23:59:59"}.to_msgpack)
|
94
|
+
|
95
|
+
d.run
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_write
|
99
|
+
|
100
|
+
d = create_driver()
|
101
|
+
|
102
|
+
tag = "test"
|
103
|
+
time = Time.parse("2012-02-28 23:59:59 UTC").to_i
|
104
|
+
d.emit({"b" => 1}, time)
|
105
|
+
d.emit({"b" => 2}, time)
|
106
|
+
d.run
|
107
|
+
|
108
|
+
# MEMO: first_example does not running.. bug?
|
109
|
+
#cursor = @col.query.execute(%[FOR t IN #{DEFAULT_COL} FILTER t.b == 1 RETURN t])
|
110
|
+
doc1 = @col.query.by_example(b:1).detect{true}
|
111
|
+
assert_equal 1, doc1["b"]
|
112
|
+
assert_equal tag, doc1["tag"]
|
113
|
+
assert_equal "2012-02-28T23:59:59Z", doc1["time"]
|
114
|
+
|
115
|
+
doc2 = @col.query.by_example(b:2).detect{true}
|
116
|
+
assert_equal 2, doc2["b"]
|
117
|
+
assert_equal tag, doc2["tag"]
|
118
|
+
assert_equal "2012-02-28T23:59:59Z", doc2["time"]
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-arango
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- tamtam180
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: fluentd
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.10.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.10.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ashikawa-core
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.5.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.5.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.2
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.2
|
62
|
+
description: ArangoDB plugin for Fluent event collector
|
63
|
+
email:
|
64
|
+
- kirscheless@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- AUTHORS
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.rdoc
|
74
|
+
- Rakefile
|
75
|
+
- VERSION
|
76
|
+
- fluent-plugin-arango.gemspec
|
77
|
+
- lib/fluent/plugin/out_arango.rb
|
78
|
+
- test/plugin/out_arango.rb
|
79
|
+
homepage: ''
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.24
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: ArangoDB plugin for Fluent event collector
|
103
|
+
test_files:
|
104
|
+
- test/plugin/out_arango.rb
|