fluent-plugin-cassandra 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +32 -4
- data/Rakefile +12 -11
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_cassandra.rb +16 -13
- metadata +18 -20
- data/.document +0 -5
- data/fluent-plugin-cassandra.gemspec +0 -63
data/README.rdoc
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
= fluent-plugin-cassandra
|
2
2
|
|
3
|
-
=
|
3
|
+
= Cassandra output plugin for Fluent
|
4
4
|
|
5
5
|
== Configuratin
|
6
6
|
|
7
|
-
<match
|
7
|
+
<match cassandra.**> # cassandra's key is tags + event.time.
|
8
8
|
type cassandra #
|
9
|
-
|
10
|
-
|
9
|
+
localtime # set localtime for key
|
10
|
+
keyspace FluentdLoggers # keyspace
|
11
|
+
columnfamily EventLogger # Columnfamily
|
11
12
|
|
12
13
|
# following attibutes are optional
|
13
14
|
host localhost # cassandra's hostname. default localhost
|
@@ -20,9 +21,36 @@
|
|
20
21
|
=== More configuration
|
21
22
|
|
22
23
|
- Create Keyspace
|
24
|
+
|
25
|
+
create keyspace FluentdLoggers
|
26
|
+
with strategy_options=[{replication_factor:1}]
|
27
|
+
and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy';
|
28
|
+
|
29
|
+
|
23
30
|
- Create Columnfamily
|
31
|
+
#example CF
|
32
|
+
|
33
|
+
use FluentdLoggers;
|
34
|
+
|
35
|
+
create column family EventLogger
|
36
|
+
with comparator = UTF8Type
|
37
|
+
and column_metadata = [{
|
38
|
+
column_name : tag,
|
39
|
+
validation_class: UTF8Type,
|
40
|
+
index_name : tag_idx,
|
41
|
+
index_type: KEYS},{
|
42
|
+
column_name : time,
|
43
|
+
validation_class : BytesType,
|
44
|
+
index_name : time_idx,
|
45
|
+
index_type: KEYS}
|
46
|
+
];
|
47
|
+
|
24
48
|
- etc
|
25
49
|
|
50
|
+
put plugin
|
51
|
+
cp -ip ${GEM PATHS}/gem/fluent-plugin-cassandra-0.0.2/lib/fluent/plugin/out_cassandra.rb /etc/fluent/plugin/.
|
52
|
+
|
53
|
+
|
26
54
|
=== Infer collection name
|
27
55
|
|
28
56
|
Fluent tag and event.time is key in Cassandra.
|
data/Rakefile
CHANGED
@@ -21,26 +21,28 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.description = "Cassandra output plugin for Fluent event collector"
|
22
22
|
gem.email = "tomitakazutaka@gmail.com"
|
23
23
|
gem.authors = ["Kazutaka Tomita"]
|
24
|
-
gem.
|
25
|
-
gem.add_dependency
|
24
|
+
gem.version = '0.0.2'
|
25
|
+
gem.add_dependency("fluentd", "~> 0.10.0")
|
26
|
+
gem.add_dependency("cassandra", "~> 0.12.1")
|
27
|
+
gem.files = FileList['lib/fluent/plugin/out_cassandra.rb', '[A-Z]*'].to_a
|
28
|
+
gem.bindir = '/etc/fluent/plugin'
|
26
29
|
|
27
|
-
# dependencies defined in Gemfile
|
28
30
|
end
|
29
31
|
Jeweler::RubygemsDotOrgTasks.new
|
30
32
|
|
31
33
|
require 'rake/testtask'
|
32
34
|
Rake::TestTask.new(:test) do |test|
|
33
|
-
test.libs << 'lib' << 'test'
|
34
|
-
test.pattern = 'test/**/test_*.rb'
|
35
|
-
test.verbose = true
|
35
|
+
# test.libs << 'lib' << 'test'
|
36
|
+
# test.pattern = 'test/**/test_*.rb'
|
37
|
+
# test.verbose = true
|
36
38
|
end
|
37
39
|
|
38
40
|
require 'rcov/rcovtask'
|
39
41
|
Rcov::RcovTask.new do |test|
|
40
|
-
test.libs << 'test'
|
41
|
-
test.pattern = 'test/**/test_*.rb'
|
42
|
-
test.verbose = true
|
43
|
-
test.rcov_opts << '--exclude "gems/*"'
|
42
|
+
# test.libs << 'test'
|
43
|
+
# test.pattern = 'test/**/test_*.rb'
|
44
|
+
# test.verbose = true
|
45
|
+
# test.rcov_opts << '--exclude "gems/*"'
|
44
46
|
end
|
45
47
|
|
46
48
|
task :default => :test
|
@@ -52,5 +54,4 @@ Rake::RDocTask.new do |rdoc|
|
|
52
54
|
rdoc.rdoc_dir = 'rdoc'
|
53
55
|
rdoc.title = "fluent-plugin-cassandra #{version}"
|
54
56
|
rdoc.rdoc_files.include('README*')
|
55
|
-
rdoc.rdoc_files.include('lib/fluent/plugin/*.rb')
|
56
57
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -3,6 +3,12 @@ module Fluent
|
|
3
3
|
|
4
4
|
class CassandraOutput < BufferedOutput
|
5
5
|
Fluent::Plugin.register_output('cassandra', self)
|
6
|
+
include SetTimeKeyMixin
|
7
|
+
include SetTagKeyMixin
|
8
|
+
config_set_default :include_time_key, true
|
9
|
+
config_set_default :include_tag_key, true
|
10
|
+
config_set_default :time_format, "%Y%m%d%H%M%S"
|
11
|
+
|
6
12
|
|
7
13
|
def initialize
|
8
14
|
super
|
@@ -13,8 +19,8 @@ class CassandraOutput < BufferedOutput
|
|
13
19
|
def configure(conf)
|
14
20
|
super
|
15
21
|
|
16
|
-
raise ConfigError, "'Keyspace' parameter is required on
|
17
|
-
raise ConfigError, "'ColumnFamily' parameter is required on
|
22
|
+
raise ConfigError, "'Keyspace' parameter is required on cassandra output" unless @keyspace = conf['keyspace']
|
23
|
+
raise ConfigError, "'ColumnFamily' parameter is required on cassandra output" unless @columnfamily = conf['columnfamily']
|
18
24
|
|
19
25
|
@host = conf.has_key?('host') ? conf['host'] : 'localhost'
|
20
26
|
@port = conf.has_key?('port') ? conf['port'] : 9160
|
@@ -29,20 +35,17 @@ class CassandraOutput < BufferedOutput
|
|
29
35
|
super
|
30
36
|
end
|
31
37
|
|
32
|
-
def format(tag,
|
33
|
-
|
38
|
+
def format(tag, time,record)
|
39
|
+
record.to_msgpack
|
34
40
|
end
|
35
41
|
|
36
42
|
def write(chunk)
|
37
|
-
chunk.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
rescue EOFError
|
44
|
-
# EOFError always occured when reached end of chunk.
|
45
|
-
end
|
43
|
+
chunk.msgpack_each { |record|
|
44
|
+
@connection.insert(
|
45
|
+
@columnfamily,
|
46
|
+
record["tag"] + "_" + record["time"].to_s,
|
47
|
+
record
|
48
|
+
)
|
46
49
|
}
|
47
50
|
end
|
48
51
|
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-cassandra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kazutaka Tomita
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: /etc/fluent/plugin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &24711020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *24711020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &24709860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *24709860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &24676540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *24676540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &24674980 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,21 +54,21 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *24674980
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement: &
|
59
|
+
name: fluentd
|
60
|
+
requirement: &24673780 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
65
|
+
version: 0.10.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *24673780
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cassandra
|
71
|
-
requirement: &
|
71
|
+
requirement: &24672460 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 0.12.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *24672460
|
80
80
|
description: Cassandra output plugin for Fluent event collector
|
81
81
|
email: tomitakazutaka@gmail.com
|
82
82
|
executables: []
|
@@ -85,14 +85,12 @@ extra_rdoc_files:
|
|
85
85
|
- LICENSE.txt
|
86
86
|
- README.rdoc
|
87
87
|
files:
|
88
|
-
- .document
|
89
88
|
- Gemfile
|
90
89
|
- Gemfile.lock
|
91
90
|
- LICENSE.txt
|
92
91
|
- README.rdoc
|
93
92
|
- Rakefile
|
94
93
|
- VERSION
|
95
|
-
- fluent-plugin-cassandra.gemspec
|
96
94
|
- lib/fluent/plugin/out_cassandra.rb
|
97
95
|
homepage: http://github.com/tomitakazutaka/fluent-plugin-cassandra
|
98
96
|
licenses:
|
@@ -109,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
107
|
version: '0'
|
110
108
|
segments:
|
111
109
|
- 0
|
112
|
-
hash:
|
110
|
+
hash: 1258677813083483526
|
113
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
112
|
none: false
|
115
113
|
requirements:
|
data/.document
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "fluent-plugin-cassandra"
|
8
|
-
s.version = "0.0.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Kazutaka Tomita"]
|
12
|
-
s.date = "2011-10-03"
|
13
|
-
s.description = "Cassandra output plugin for Fluent event collector"
|
14
|
-
s.email = "tomitakazutaka@gmail.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"fluent-plugin-cassandra.gemspec",
|
28
|
-
"lib/fluent/plugin/out_cassandra.rb"
|
29
|
-
]
|
30
|
-
s.homepage = "http://github.com/tomitakazutaka/fluent-plugin-cassandra"
|
31
|
-
s.licenses = ["MIT"]
|
32
|
-
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = "1.8.10"
|
34
|
-
s.summary = "Cassandra output plugin for Fluent event collector"
|
35
|
-
|
36
|
-
if s.respond_to? :specification_version then
|
37
|
-
s.specification_version = 3
|
38
|
-
|
39
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
41
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
42
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
43
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
44
|
-
s.add_runtime_dependency(%q<fluent>, ["~> 0.9.14"])
|
45
|
-
s.add_runtime_dependency(%q<cassandra>, ["~> 0.12.1"])
|
46
|
-
else
|
47
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
48
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
50
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
51
|
-
s.add_dependency(%q<fluent>, ["~> 0.9.14"])
|
52
|
-
s.add_dependency(%q<cassandra>, ["~> 0.12.1"])
|
53
|
-
end
|
54
|
-
else
|
55
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
56
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
57
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
58
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
59
|
-
s.add_dependency(%q<fluent>, ["~> 0.9.14"])
|
60
|
-
s.add_dependency(%q<cassandra>, ["~> 0.12.1"])
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|