fluent-plugin-pghstore 0.0.1 → 0.0.2
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.
- data/README.rdoc +8 -4
- data/fluent-plugin-pghstore.gemspec +1 -1
- data/lib/fluent/plugin/out_pghstore.rb +6 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -9,11 +9,13 @@ Output to PostgreSQL hstore database.
|
|
9
9
|
Output table should have tag, time and record column.:
|
10
10
|
|
11
11
|
CREATE TABLE #{tablename} (
|
12
|
-
tag TEXT,
|
12
|
+
tag TEXT[],
|
13
13
|
time TIMESTAMP WITH TIME ZONE,
|
14
14
|
record HSTORE
|
15
15
|
);
|
16
16
|
|
17
|
+
A tag is splited by "." and stored in the TEXT[]. (Yes, postgres can handle an array!)
|
18
|
+
|
17
19
|
== Requirement
|
18
20
|
|
19
21
|
- PostgreSQL 9.0 or higher
|
@@ -51,7 +53,9 @@ Example:
|
|
51
53
|
- database name
|
52
54
|
- Optional
|
53
55
|
- table
|
54
|
-
- tablename.
|
56
|
+
- tablename.
|
57
|
+
- If not set, use +fluentd_store+.
|
58
|
+
- If not exists, creates automatically.
|
55
59
|
- host
|
56
60
|
- port
|
57
61
|
- user
|
@@ -62,12 +66,12 @@ Example:
|
|
62
66
|
== Limitation
|
63
67
|
|
64
68
|
- Nested output is not allowd.
|
65
|
-
- Since using only one connection, performance may become bad. When you meet this, use connection pooling and write patch!
|
66
|
-
|
69
|
+
- Since using only one connection, the performance may become bad. When you meet this, use connection pooling and write patch!
|
67
70
|
|
68
71
|
== Thanks
|
69
72
|
|
70
73
|
This source code is mainly borrowed from
|
74
|
+
|
71
75
|
{fluent-plugin-datacounter}{https://rubygems.org/gems/fluent-plugin-datacounter}. Thank you for tagomoris.
|
72
76
|
|
73
77
|
== Copyright
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-pghstore"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.2"
|
7
7
|
s.authors = ["WAKAYAMA Shirou"]
|
8
8
|
s.email = ["shirou.faw@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/r_rudi/fluent-plugin-pghstore"
|
@@ -55,10 +55,14 @@ class Fluent::PgHStoreOutput < Fluent::BufferedOutput
|
|
55
55
|
end
|
56
56
|
}
|
57
57
|
|
58
|
+
tag_list = tag.split(".")
|
59
|
+
tag_list.map! {|t| "'" + t + "'"}
|
60
|
+
|
58
61
|
sql =<<"SQL"
|
59
62
|
INSERT INTO #{@table} (tag, time, record) VALUES
|
60
|
-
(
|
63
|
+
(ARRAY[#{tag_list.join(",")}], '#{Time.at(time)}'::TIMESTAMP WITH TIME ZONE, '#{kv_list.join(",")}');
|
61
64
|
SQL
|
65
|
+
|
62
66
|
return sql
|
63
67
|
end
|
64
68
|
|
@@ -86,7 +90,7 @@ SQL
|
|
86
90
|
def create_table(tablename)
|
87
91
|
sql =<<"SQL"
|
88
92
|
CREATE TABLE #{tablename} (
|
89
|
-
tag TEXT,
|
93
|
+
tag TEXT[],
|
90
94
|
time TIMESTAMP WITH TIME ZONE,
|
91
95
|
record HSTORE
|
92
96
|
);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-pghstore
|
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:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|