fluent-plugin-rds-log 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +26 -41
- data/fluent-plugin-rds-log.gemspec +1 -1
- data/lib/fluent/plugin/in_rds_log.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da64c20018f36f4d7caf310b578c50b0790617ae
|
4
|
+
data.tar.gz: f4cded66ac824cfe5bbdb6336b87f1fee536e76c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7711fd2858cfdd41ca01aadb5db3071d29adab5c4ab33c0bc3166e0e6e83341b09e7f5a809aefe0a7718a55257ac52966ea904416df972f9d56fb93f6678d96b
|
7
|
+
data.tar.gz: dd7afd322ab1de2cdce5ff50d5210711017ad09946f30445b3a5eb9af65bad6e204082eff78addb912f53f2bcbc78db8e63f1911dd915053c6bdc5874aa0fb39
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,69 +1,54 @@
|
|
1
|
-
#
|
1
|
+
# Amazon RDS (for MySQL) input plugin
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
***Amazon Web Services RDS(MySQL) general_log and slow_log input plugin.
|
5
|
+
|
6
|
+
##Installation
|
7
|
+
|
8
|
+
$ fluent-gem install fluent-plugin-rds-log
|
2
9
|
|
3
10
|
## RDS Setting
|
4
11
|
|
5
12
|
[Working with MySQL Database Log Files / aws documentation](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.MySQL.html)
|
6
13
|
|
14
|
+
- Set the `log_output` parameter to `TABLE` to write the logs to a database table.
|
7
15
|
- Set the `slow_query_log` parameter to `1`
|
16
|
+
- Set the `general_log` parameter to `1`
|
8
17
|
- setting `min_examined_row_limit`
|
9
18
|
- setting `long_query_time`
|
10
19
|
|
11
|
-
## Overview
|
12
|
-
***AWS RDS slow_log*** input plugin.
|
13
|
-
|
14
|
-
1. **"SELECT * FROM slow_log"**
|
15
|
-
2. **"CALL mysql.rds_rotate_slow_log"**
|
16
|
-
|
17
|
-
every 10 seconds from AWS RDS.
|
18
|
-
|
19
20
|
## Configuration
|
20
21
|
|
21
22
|
```config
|
22
23
|
<source>
|
23
|
-
type
|
24
|
-
|
24
|
+
type rds_log
|
25
|
+
log_type <slow_log | general_log>
|
25
26
|
host [RDS Hostname]
|
26
27
|
username [RDS Username]
|
27
28
|
password [RDS Password]
|
28
|
-
|
29
|
-
|
29
|
+
refresh_interval [number]
|
30
|
+
auto_reconnect [true|false]
|
31
|
+
tag [tag-name]
|
30
32
|
</source>
|
31
33
|
```
|
32
34
|
|
33
|
-
### Example GET RDS
|
35
|
+
### Example GET RDS general_log
|
34
36
|
|
35
37
|
```config
|
36
38
|
<source>
|
37
|
-
type
|
38
|
-
|
39
|
-
host
|
40
|
-
username
|
41
|
-
password
|
42
|
-
|
43
|
-
|
39
|
+
type rds_log
|
40
|
+
log_type general_log
|
41
|
+
host endpoint.abcdefghijkl.ap-northeast-1.rds.amazonaws.com
|
42
|
+
username rds_user
|
43
|
+
password rds_password
|
44
|
+
refresh_interval 30
|
45
|
+
auto_reconnect true
|
46
|
+
tag rds-general-log
|
44
47
|
</source>
|
45
48
|
|
46
|
-
<match rds-
|
47
|
-
type copy
|
48
|
-
<store>
|
49
|
+
<match rds-general-log>
|
49
50
|
type file
|
50
|
-
path /var/log/
|
51
|
-
</store>
|
51
|
+
path /var/log/rds-general-log
|
52
52
|
</match>
|
53
53
|
```
|
54
54
|
|
55
|
-
#### output data format
|
56
|
-
|
57
|
-
```
|
58
|
-
2013-03-08T16:04:43+09:00 rds-slowlog {"start_time":"2013-03-08 07:04:38","user_host":"rds_db[rds_db] @ [192.0.2.10]","query_time":"00:00:00","lock_time":"00:00:00","rows_sent":"3000","rows_examined":"3000","db":"rds_db","last_insert_id":"0","insert_id":"0","server_id":"100000000","sql_text":"select foo from bar"}
|
59
|
-
2013-03-08T16:04:43+09:00 rds-slowlog {"start_time":"2013-03-08 07:04:38","user_host":"rds_db[rds_db] @ [192.0.2.10]","query_time":"00:00:00","lock_time":"00:00:00","rows_sent":"3000","rows_examined":"3000","db":"rds_db","last_insert_id":"0","insert_id":"0","server_id":"100000000","sql_text":"Quit"}
|
60
|
-
```
|
61
|
-
|
62
|
-
#### if not connect
|
63
|
-
|
64
|
-
- td-agent.log
|
65
|
-
|
66
|
-
```
|
67
|
-
2013-06-29 00:32:55 +0900 [error]: fluent-plugin-rds-log: cannot connect RDS
|
68
|
-
```
|
69
|
-
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "fluent-plugin-rds-log"
|
7
|
-
gem.version = "0.1.
|
7
|
+
gem.version = "0.1.1"
|
8
8
|
gem.authors = ["shinsaka"]
|
9
9
|
gem.email = ["shinx1265@gmail.com"]
|
10
10
|
gem.description = "Amazon RDS slow_log and general_log input plugin for Fluent event collector"
|
@@ -8,6 +8,7 @@ class Fluent::Rds_LogInput < Fluent::Input
|
|
8
8
|
config_param :password, :string, :default => nil
|
9
9
|
config_param :log_type, :string, :default => nil
|
10
10
|
config_param :refresh_interval, :integer, :default => 30
|
11
|
+
config_param :auto_reconnect, :bool, :default => true
|
11
12
|
|
12
13
|
def initialize
|
13
14
|
super
|
@@ -25,6 +26,7 @@ class Fluent::Rds_LogInput < Fluent::Input
|
|
25
26
|
:port => @port,
|
26
27
|
:username => @username,
|
27
28
|
:password => @password,
|
29
|
+
:reconnect => @auto_reconnect
|
28
30
|
:database => 'mysql'
|
29
31
|
})
|
30
32
|
rescue
|
@@ -56,6 +58,7 @@ class Fluent::Rds_LogInput < Fluent::Input
|
|
56
58
|
|
57
59
|
output_log_data = @client.query("SELECT * FROM mysql.#{@log_type}_backup", :cast => false)
|
58
60
|
output_log_data.each do |row|
|
61
|
+
row.delete_if{|key,value| value == ''}
|
59
62
|
Fluent::Engine.emit(tag, Fluent::Engine.now, row)
|
60
63
|
end
|
61
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-rds-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shinsaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|