fluent-plugin-rds-pgsql-log 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/fluent-plugin-rds-pgsql-log.gemspec +2 -2
- data/fluent.conf.sample +2 -2
- data/lib/fluent/plugin/in_rds_pgsql_log.rb +7 -6
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a19cfb030a36b84f37a0715f2e8a613d63930cac
|
4
|
+
data.tar.gz: bf7d64fc9cb5552e11b5125dccdb4ddfc55b48a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e42cccd4e4ccf39f5625bb758835b3fb29df474d197e4f3d964c8d153734a911cba209ae7bb02f7d499205ed753b6bef7d10700edac24be2eaea3f59c290e5aa
|
7
|
+
data.tar.gz: 69b08f190611b337def1d02fc375e68972be5e0dae197f95de10698f703187920cba473c211f3325d2c4fd01239f22f7a2ddc195abcdcbc9470b5dfea30f0ada
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Amazon RDS for PostgreSQL log input plugin for fluentd
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/fluent-plugin-rds-pgsql-log.svg)](https://badge.fury.io/rb/fluent-plugin-rds-pgsql-log)
|
4
|
+
|
3
5
|
## Overview
|
4
6
|
- Amazon Web Services RDS log input plugin for fluentd
|
5
7
|
|
6
8
|
## Installation
|
7
9
|
|
8
|
-
$ fluentd-gem fluent-plugin-rds-pgsql-log
|
10
|
+
$ fluentd-gem install fluent-plugin-rds-pgsql-log
|
9
11
|
|
10
12
|
## AWS ELB Settings
|
11
13
|
- settings see: [PostgreSQL Database Log Files](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.PostgreSQL.html)
|
@@ -70,3 +72,7 @@ SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt (If you using amazon linux)
|
|
70
72
|
}
|
71
73
|
```
|
72
74
|
|
75
|
+
## Changes
|
76
|
+
### 0.2.0
|
77
|
+
- require fluentd version 0.14.0
|
78
|
+
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "fluent-plugin-rds-pgsql-log"
|
6
|
-
spec.version = "0.
|
6
|
+
spec.version = "0.2.0"
|
7
7
|
spec.authors = ["shinsaka"]
|
8
8
|
spec.email = ["shinx1265@gmail.com"]
|
9
9
|
spec.summary = "Amazon RDS for PostgreSQL log input plugin"
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency "fluentd", "
|
19
|
+
spec.add_dependency "fluentd", ">= 0.14.0", "< 2"
|
20
20
|
spec.add_dependency "aws-sdk", "~> 2"
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.7"
|
data/fluent.conf.sample
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<source>
|
2
|
-
type rds_pgsql_log
|
2
|
+
@type rds_pgsql_log
|
3
3
|
access_key_id XXXXXXXXXXXXXXXXXXXX
|
4
4
|
secret_access_key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
5
5
|
region ap-northeast-1
|
@@ -10,5 +10,5 @@
|
|
10
10
|
</source>
|
11
11
|
|
12
12
|
<match pgsql.log>
|
13
|
-
type stdout
|
13
|
+
@type stdout
|
14
14
|
</match>
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
require 'fluent/input'
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
class Fluent::Plugin::RdsPgsqlLogInput < Fluent::Plugin::Input
|
2
5
|
Fluent::Plugin.register_input('rds_pgsql_log', self)
|
3
6
|
|
4
7
|
LOG_REGEXP = /^(?<time>\d{4}-\d{2}-\d{2} \d{2}\:\d{2}\:\d{2} .+?):(?<host>.*?):(?<user>.*?)@(?<database>.*?):\[(?<pid>.*?)\]:(?<message_level>.*?):(?<message>.*)$/
|
@@ -13,13 +16,12 @@ class Fluent::RdsPgsqlLogInput < Fluent::Input
|
|
13
16
|
|
14
17
|
def configure(conf)
|
15
18
|
super
|
16
|
-
require 'aws-sdk'
|
17
19
|
|
20
|
+
raise Fluent::ConfigError.new("region is required") unless @region
|
18
21
|
if !has_iam_role?
|
19
22
|
raise Fluent::ConfigError.new("access_key_id is required") if @access_key_id.nil?
|
20
23
|
raise Fluent::ConfigError.new("secret_access_key is required") if @secret_access_key.nil?
|
21
24
|
end
|
22
|
-
raise Fluent::ConfigError.new("region is required") unless @region
|
23
25
|
raise Fluent::ConfigError.new("db_instance_identifier is required") unless @db_instance_identifier
|
24
26
|
raise Fluent::ConfigError.new("pos_file is required") unless @pos_file
|
25
27
|
raise Fluent::ConfigError.new("refresh_interval is required") unless @refresh_interval
|
@@ -55,7 +57,6 @@ class Fluent::RdsPgsqlLogInput < Fluent::Input
|
|
55
57
|
super
|
56
58
|
@loop.stop
|
57
59
|
@thread.join
|
58
|
-
@timestamp_file.close
|
59
60
|
end
|
60
61
|
|
61
62
|
private
|
@@ -196,7 +197,7 @@ class Fluent::RdsPgsqlLogInput < Fluent::Input
|
|
196
197
|
record["message"] << "\n" + raw_record unless record.nil?
|
197
198
|
else
|
198
199
|
# emit before record
|
199
|
-
|
200
|
+
router.emit(@tag, Fluent::Engine.now, record) unless record.nil?
|
200
201
|
|
201
202
|
# set a record
|
202
203
|
record = {
|
@@ -212,7 +213,7 @@ class Fluent::RdsPgsqlLogInput < Fluent::Input
|
|
212
213
|
end
|
213
214
|
end
|
214
215
|
# emit last record
|
215
|
-
|
216
|
+
router.emit(@tag, Fluent::Engine.now, record) unless record.nil?
|
216
217
|
rescue => e
|
217
218
|
$log.warn e.message
|
218
219
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-rds-pgsql-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shinsaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.14.0
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.14.0
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: aws-sdk
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
92
|
version: '0'
|
87
93
|
requirements: []
|
88
94
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.6.11
|
90
96
|
signing_key:
|
91
97
|
specification_version: 4
|
92
98
|
summary: Amazon RDS for PostgreSQL log input plugin
|