fluent-plugin-pgjson 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linux.yml +47 -0
- data/README.md +24 -27
- data/fluent-plugin-pgjson.gemspec +2 -1
- data/lib/fluent/plugin/out_pgjson.rb +5 -1
- metadata +21 -7
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b50876105f70aba6215cda3bea847f0497209437587954d46808e4820ee62ad
|
4
|
+
data.tar.gz: c201ea0e5587f595dfb537840efd474689342f2a53683d1c5cce8d09860f8684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d9799ad2d645a1a72f569f18aa8312d5d920e0b85707e23b1cac36cabe98ec4abfb1ff0335af13fd26db6bd93b09ea9ce47d140684c4f286392d86159fa392
|
7
|
+
data.tar.gz: 948bdf734a3506afafaba993d77ff6e62c18afe141f412a608c2b74debe75a58ed81c5e0883ae1484ae2505817cebbaa2cdb96f1a99bc6035b59b42cbda6f8f2
|
@@ -0,0 +1,47 @@
|
|
1
|
+
name: linux
|
2
|
+
on:
|
3
|
+
- push
|
4
|
+
- pull_request
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ${{ matrix.os }}
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0' ]
|
12
|
+
postgres: [ '9', '10', '11', '12', '13' ]
|
13
|
+
os:
|
14
|
+
- ubuntu-latest
|
15
|
+
services:
|
16
|
+
postgres:
|
17
|
+
image: postgres:${{ matrix.postgres }}
|
18
|
+
ports:
|
19
|
+
- 5432:5432
|
20
|
+
env:
|
21
|
+
POSTGRES_USER: postgres
|
22
|
+
POSTGRES_PASSWORD: password
|
23
|
+
POSTGRES_DB: test
|
24
|
+
options: >-
|
25
|
+
--health-cmd pg_isready
|
26
|
+
--health-interval 10s
|
27
|
+
--health-timeout 5s
|
28
|
+
--health-retries 5
|
29
|
+
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
- name: prepare database
|
36
|
+
env:
|
37
|
+
PGPASSWORD: password
|
38
|
+
run: |
|
39
|
+
psql -h localhost -p 5432 -U postgres -c "create role fluentd with LOGIN CREATEDB password 'fluentd';"
|
40
|
+
psql -h localhost -p 5432 -U postgres -c "create database pgjsontest owner fluentd encoding 'utf-8'" -U postgres
|
41
|
+
- name: unit testing
|
42
|
+
env:
|
43
|
+
CI: true
|
44
|
+
run: |
|
45
|
+
gem install bundler rake
|
46
|
+
bundle install --jobs 4 --retry 3
|
47
|
+
bundle exec rake test
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Fluent::Plugin::PgJson, a plugin for [Fluentd](http://fluentd.org)
|
2
2
|
|
3
|
+
![linux](https://github.com/fluent-plugins-nursery/fluent-plugin-pgjson/workflows/linux/badge.svg?branch=master)
|
4
|
+
|
3
5
|
Output Plugin for PostgreSQL Json Type.
|
4
6
|
|
5
7
|
<b>Json type is availble in PostgreSQL version over 9.2</b>
|
@@ -55,42 +57,37 @@ CREATE TABLE fluentd (
|
|
55
57
|
```
|
56
58
|
<match **>
|
57
59
|
@type pgjson
|
58
|
-
host localhost
|
59
|
-
port 5432
|
60
|
-
sslmode
|
60
|
+
#host localhost
|
61
|
+
#port 5432
|
62
|
+
#sslmode prefer
|
61
63
|
database fluentd
|
62
64
|
table fluentd
|
63
65
|
user postgres
|
64
66
|
password postgres
|
65
|
-
time_col time
|
66
|
-
tag_col tag
|
67
|
-
record_col record
|
67
|
+
#time_col time
|
68
|
+
#tag_col tag
|
69
|
+
#record_col record
|
70
|
+
#msgpack false
|
71
|
+
#encoder yajl
|
68
72
|
</match>
|
69
73
|
```
|
70
74
|
|
71
75
|
### Parameter
|
72
76
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
* Default value: `tag`.
|
88
|
-
* **record_col** (string) (optional): The column name for the record
|
89
|
-
* Default value: `record`.
|
90
|
-
* **msgpack** (bool) (optional): If true, insert records formatted as msgpack
|
91
|
-
* **encoder** (enum) (optional): JSON encoder (yajl/json)
|
92
|
-
* Available values: yajl, json
|
93
|
-
* Default value: `yajl`.
|
77
|
+
|parameter|description|default|
|
78
|
+
|---|---|---|
|
79
|
+
|host|The hostname of PostgreSQL server|localhost|
|
80
|
+
|port|The port of PostgreSQL server|5432|
|
81
|
+
|sslmode|Set the sslmode to enable Eavesdropping protection/MITM protection. See [PostgreSQL Documentation](https://www.postgresql.org/docs/10/static/libpq-ssl.html) for more details. (`disable`, `allow`, `prefer`, `require`, `verify-ca`, `verify-full`)|`prefer`|
|
82
|
+
|database|The database name to connect||
|
83
|
+
|table|The table name to insert records||
|
84
|
+
|user|The user name to connect database|nil|
|
85
|
+
|password|The password to connect database|nil|
|
86
|
+
|time_col|The column name for the time|`time`|
|
87
|
+
|tag_col|The column name for the tag|`tag`|
|
88
|
+
|record_col|The column name for the record|`record`|
|
89
|
+
|msgpack|If true, insert records formatted as msgpack|`false`|
|
90
|
+
|encoder|JSON encoder (`yajl`, `json`)|`yajl`|
|
94
91
|
|
95
92
|
## Copyright
|
96
93
|
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "fluent-plugin-pgjson"
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.2"
|
6
6
|
s.authors = ["OKUNO Akihiro"]
|
7
7
|
s.email = ["choplin.choplin@gmail.com"]
|
8
8
|
s.homepage = "https://github.com/fluent-plugins-nursery/fluent-plugin-pgjson"
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency "pg"
|
20
20
|
s.add_development_dependency "test-unit", ">= 3.1.0"
|
21
21
|
s.add_development_dependency "rake", ">= 11.0"
|
22
|
+
s.add_development_dependency "webrick"
|
22
23
|
end
|
@@ -84,12 +84,16 @@ module Fluent::Plugin
|
|
84
84
|
|
85
85
|
def write(chunk)
|
86
86
|
init_connection
|
87
|
-
@conn.exec("COPY #{@table} (#{@tag_col}, #{@time_col}, #{@record_col}) FROM STDIN WITH DELIMITER E'\\x01'")
|
88
87
|
begin
|
88
|
+
@conn.exec("COPY #{@table} (#{@tag_col}, #{@time_col}, #{@record_col}) FROM STDIN WITH DELIMITER E'\\x01'")
|
89
89
|
tag = chunk.metadata.tag
|
90
90
|
chunk.msgpack_each do |time, record|
|
91
91
|
@conn.put_copy_data "#{tag}\x01#{time}\x01#{record_value(record)}\n"
|
92
92
|
end
|
93
|
+
rescue PG::UnableToSend
|
94
|
+
@conn.close()
|
95
|
+
@conn = nil
|
96
|
+
raise
|
93
97
|
rescue => err
|
94
98
|
errmsg = "%s while copy data: %s" % [ err.class.name, err.message ]
|
95
99
|
@conn.put_copy_end( errmsg )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-pgjson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OKUNO Akihiro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '11.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: webrick
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
75
89
|
description: ''
|
76
90
|
email:
|
77
91
|
- choplin.choplin@gmail.com
|
@@ -79,8 +93,8 @@ executables: []
|
|
79
93
|
extensions: []
|
80
94
|
extra_rdoc_files: []
|
81
95
|
files:
|
96
|
+
- ".github/workflows/linux.yml"
|
82
97
|
- ".gitignore"
|
83
|
-
- ".travis.yml"
|
84
98
|
- Gemfile
|
85
99
|
- LICENSE
|
86
100
|
- README.md
|
@@ -94,7 +108,7 @@ homepage: https://github.com/fluent-plugins-nursery/fluent-plugin-pgjson
|
|
94
108
|
licenses:
|
95
109
|
- Apache-2.0
|
96
110
|
metadata: {}
|
97
|
-
post_install_message:
|
111
|
+
post_install_message:
|
98
112
|
rdoc_options: []
|
99
113
|
require_paths:
|
100
114
|
- lib
|
@@ -109,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
126
|
+
rubygems_version: 3.2.30
|
127
|
+
signing_key:
|
114
128
|
specification_version: 4
|
115
129
|
summary: Fluentd Output Plugin for PostgreSQL JSON Type.
|
116
130
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.4
|
5
|
-
- 2.5
|
6
|
-
- 2.6
|
7
|
-
- 2.7.1
|
8
|
-
|
9
|
-
addons:
|
10
|
-
postgresql: "9.6"
|
11
|
-
|
12
|
-
services:
|
13
|
-
- postgresql
|
14
|
-
|
15
|
-
before_script:
|
16
|
-
- psql -c "create role fluentd with LOGIN CREATEDB password 'fluentd';" -U postgres
|
17
|
-
- psql -c "create database pgjsontest owner fluentd encoding 'utf-8'" -U postgres
|