fluent-plugin-rethink 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8f44108b92dd2dd6d1693d2898e413716bce3e19
4
+ data.tar.gz: 4f2e7a93af6f65f19df91f5e931d49fc938d0a9e
5
+ SHA512:
6
+ metadata.gz: 543e86cb5de5484efc1a45d07a37443e146735f4b18ba222acff8de0b4a79757cc11d2f14efe8855b825b2d3b1d2c913190590ac24df871adf418fd2a7bc2446
7
+ data.tar.gz: 70d34fa2a08cd6326a44259922b343c108df2f1386c4444e77211ef270eae4de9897e5a4f21273ac602ad7f00828487c26ccb38281b7187bcbf6e776fecca6d0
data/AUTHORS ADDED
@@ -0,0 +1 @@
1
+ Vinh Nguyen <kurei@axcoto.com>
data/ChangeLog ADDED
@@ -0,0 +1,2 @@
1
+ Release 0.1.0 - 2014/10/18
2
+ * Add out_rethink
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem "simplecov", :require => false
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fluent-plugin-rethink (0.1.0)
5
+ fluentd (~> 0.10.9)
6
+ rethinkdb (>= 1.15.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ cool.io (1.2.4)
12
+ docile (1.1.5)
13
+ fluentd (0.10.55)
14
+ cool.io (>= 1.1.1, < 2.0.0, != 1.2.0)
15
+ http_parser.rb (>= 0.5.1, < 0.7.0)
16
+ json (>= 1.4.3)
17
+ msgpack (>= 0.4.4, < 0.6.0, != 0.5.3, != 0.5.2, != 0.5.1, != 0.5.0)
18
+ sigdump (~> 0.2.2)
19
+ yajl-ruby (~> 1.0)
20
+ http_parser.rb (0.6.0)
21
+ json (1.8.1)
22
+ msgpack (0.5.9)
23
+ multi_json (1.10.1)
24
+ rake (10.3.2)
25
+ rethinkdb (1.15.0.0)
26
+ json
27
+ sigdump (0.2.2)
28
+ simplecov (0.9.1)
29
+ docile (~> 1.1.0)
30
+ multi_json (~> 1.0)
31
+ simplecov-html (~> 0.8.0)
32
+ simplecov-html (0.8.0)
33
+ yajl-ruby (1.2.1)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ fluent-plugin-rethink!
40
+ rake (>= 0.9.2)
41
+ simplecov
data/README.rdoc ADDED
@@ -0,0 +1,52 @@
1
+ = RethinkDB plugin for {Fluentd}[http://github.com/fluent/fluentd]
2
+
3
+ fluent-plugin-rethink provides input and output plugins for {Fluentd}[http://fluentd.org] ({GitHub}[http://github.com/fluent/fluentd])
4
+
5
+ = Installation
6
+
7
+ == Gems
8
+
9
+ The gem is hosted at {Rubygems.org}[http://rubygems.org]. You can install the gem as follows:
10
+
11
+ $ gem install fluent-plugin-rethink
12
+
13
+ = Plugins
14
+
15
+ == Output plugin
16
+
17
+ === rethink
18
+
19
+ Store Fluentd event to RethinkDB database.
20
+
21
+ ==== Configuration
22
+
23
+ Use _rethink_ type in match.
24
+
25
+ <match rethink.**>
26
+ type rethink
27
+ database fluent
28
+ table test
29
+
30
+ # Following attibutes are optional
31
+ host localhost
32
+ port 28015
33
+
34
+ # Other buffer configurations here
35
+ </match>
36
+
37
+ = Test
38
+
39
+ Run following command:
40
+
41
+ $ bundle exec rake test
42
+
43
+ = TODO
44
+
45
+ == More configuration
46
+ == Auto create table, db
47
+
48
+ = Copyright
49
+
50
+ Copyright:: Copyright (c) 2014- kureikain
51
+ License:: Apache License, Version 0.1.0
52
+
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ $:.push File.expand_path('../lib', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "fluent-plugin-rethink"
7
+ gem.description = "RethinkDB plugin for Fluentd"
8
+ gem.homepage = "https://github.com/kureikain/fluent-plugin-rethink"
9
+ gem.summary = gem.description
10
+ gem.version = File.read("VERSION").strip
11
+ gem.authors = ["Vinh Nguyen"]
12
+ gem.email = "kurei@axcoto.com"
13
+ gem.has_rdoc = false
14
+ #gem.platform = Gem::Platform::RUBY
15
+ gem.files = `git ls-files`.split("\n")
16
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ gem.require_paths = ['lib']
19
+ gem.add_dependency "fluentd", "~> 0.10.9"
20
+ gem.add_dependency "rethinkdb", ">= 1.15.0"
21
+ gem.add_development_dependency "rake", ">= 0.9.2"
22
+ gem.add_development_dependency "simplecov", ">= 0.5.4"
23
+ end
@@ -0,0 +1,62 @@
1
+ require 'rethinkdb'
2
+ require 'logger'
3
+
4
+ module Fluent
5
+ class RethinkOutput < BufferedOutput
6
+ include RethinkDB::Shortcuts
7
+ Plugin.register_output('rethink', self)
8
+
9
+ config_param :database, :string
10
+ config_param :host, :string, :default => 'localhost'
11
+ config_param :table, :string, :default => :log
12
+ config_param :port, :integer, :default => 28015
13
+
14
+ # This method is called before starting.
15
+ # 'conf' is a Hash that includes configuration parameters.
16
+ # If the configuration is invalid, raise Fluent::ConfigError.
17
+ def configure(conf)
18
+ super
19
+
20
+ @db = conf['database']
21
+ @host = conf['host']
22
+ @port = conf['port']
23
+ @table = conf['table']
24
+ end
25
+
26
+ def start
27
+ super
28
+ @conn = r.connect(:host => @host,
29
+ :port => @port,
30
+ :db => @db)
31
+ end
32
+
33
+ def shutdown
34
+ super
35
+ @conn.close
36
+ end
37
+
38
+ def format(tag, time, record)
39
+ [tag, time, record].to_msgpack
40
+ end
41
+
42
+ # This method is called every flush interval. Write the buffer chunk
43
+ # to files or databases here.
44
+ # 'chunk' is a buffer chunk that includes multiple formatted
45
+ # events. You can use 'data = chunk.read' to get all events and
46
+ # 'chunk.open {|io| ... }' to get IO objects.
47
+ #
48
+ # NOTE! This method is called by internal thread, not Fluentd's main thread. So IO wait doesn't affect other plugins.
49
+ def write(chunk)
50
+ records = []
51
+ chunk.msgpack_each {|(tag,time,record)|
52
+ record[@time_key] = Time.at(time || record[@time_key]) if @include_time_key
53
+ records << record
54
+ }
55
+ begin
56
+ r.table("LOP").insert(records).run(@conn) unless records.empty?
57
+ rescue
58
+ end
59
+ end
60
+
61
+ end
62
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-rethink
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vinh Nguyen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.10.9
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.10.9
27
+ - !ruby/object:Gem::Dependency
28
+ name: rethinkdb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.15.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.15.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.4
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.5.4
69
+ description: RethinkDB plugin for Fluentd
70
+ email: kurei@axcoto.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - AUTHORS
76
+ - ChangeLog
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - README.rdoc
80
+ - Rakefile
81
+ - VERSION
82
+ - fluent-plugin-rethink.gemspec
83
+ - lib/fluent/plugin/out_rethink.rb
84
+ homepage: https://github.com/kureikain/fluent-plugin-rethink
85
+ licenses: []
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.2.2
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: RethinkDB plugin for Fluentd
107
+ test_files: []