fluent-plugin-aurora-slowquerylog 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +50 -12
- data/fluent-plugin-aurora-slowquerylog.gemspec +1 -1
- data/lib/fluent/plugin/in_aurora_slowquerylog.rb +5 -7
- 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: 902711f56bfb142c7fe24ce7a5affb1315d54009
|
4
|
+
data.tar.gz: 15a4881d9f91ac27806da775e7e156085a510be4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 760664ecf893dea66deb99952b687846a3502898c13a7318005426b17c9b16e05f4dd36606fba47774084c31e2ac89011f37d9ca706d92135132b56401ac2edc
|
7
|
+
data.tar.gz: 91b63cebb52470b87aae79cbb3985815a3a752a666e45191c889945abd8c8945fd88d433e0669e5e9c8f0e6e294657effe53856c6ec17115ac604c378a7e408f
|
data/README.md
CHANGED
@@ -1,28 +1,66 @@
|
|
1
|
-
#
|
1
|
+
# [Fluentd](http://fluentd.org) input plugin for AWS RDS Aurora
|
2
2
|
|
3
|
-
|
3
|
+
## Overview
|
4
|
+
This fluent input plugin collects RDS Aurora slowquery log with ParameterGroup option `log_output=FILE`.
|
5
|
+
This plugin fetches only the difference between the latest and previous fetched slow query log.
|
4
6
|
|
5
|
-
|
7
|
+
## Background
|
8
|
+
There are a lot of RDS mysql slowlog input plugins that collect mysql slowquery logs with ParameterGroup option `log_output=TABLE`.
|
9
|
+
However if you use RDS Aurora with the option, there are two following problems:
|
6
10
|
|
7
|
-
|
11
|
+
### 1. mysql.slow_log table is operated with Engine=CSV
|
8
12
|
|
9
|
-
|
13
|
+
mysql.slow_log table is operated with Engine=CSV and we cannot add index to the table.
|
14
|
+
So if tons of slow queries are registered to mysql.slow_log, your `SELECT * FROM mysql.slow_log WHERE condition` queries also become slow.
|
10
15
|
|
11
|
-
|
12
|
-
|
16
|
+
### 2. No way to rotate Aurora slowlog table
|
17
|
+
|
18
|
+
mysql.slow_log table on RDS mysql can be purged by using `CALL mysql.rds_rotate_slow_log`. On the other hand, the stored procedure executed on Aurora makes following error.
|
19
|
+
|
20
|
+
```
|
21
|
+
> CALL mysql.rds_rotate_slow_log;
|
22
|
+
ERROR 1289 (HY000): The 'CSV' feature is disabled; you need MySQL built with 'CSV' to have it working
|
13
23
|
```
|
14
24
|
|
15
|
-
|
25
|
+
According to the above reasons, I have implemented input plugin with `log_output=FILE` for Aurora.
|
16
26
|
|
17
|
-
|
27
|
+
## Installation
|
18
28
|
|
19
|
-
|
29
|
+
```ruby
|
30
|
+
$ fluent-gem install fluent-plugin-aurora-slowquerylog --no-document
|
31
|
+
```
|
20
32
|
|
21
|
-
|
33
|
+
## Input: How It Works
|
34
|
+
TBW
|
22
35
|
|
23
36
|
## Usage
|
37
|
+
### Sample configuration
|
38
|
+
|
39
|
+
```
|
40
|
+
<source>
|
41
|
+
@type aurora_slowquerylog
|
42
|
+
tag aurora.slowlog
|
43
|
+
db_instance_identifier aurora_node_id
|
44
|
+
region us-east-1
|
45
|
+
log_file_name slowquery/mysql-slowquery.log
|
46
|
+
aurora_state_file /var/run/fluentd/aurora_state
|
47
|
+
log_fetch_interval 30 #optionnal
|
48
|
+
aws_access_key_id your_aws_access_key_id #optionnal
|
49
|
+
aws_secret_access_key your_aws_secret_access_key #optionnal
|
50
|
+
filename_contains mysql-slowquery.log # default 'mysql-slowquery.log'
|
51
|
+
</source>
|
52
|
+
```
|
53
|
+
|
54
|
+
* **tag** tag name of events
|
55
|
+
* **db_instance_identifier** AWS Aurora node id
|
56
|
+
* **region** AWS region name
|
57
|
+
* **log_file_name** RDS slowlog name. Currently we cannot change file name from 'slowquery/mysql-slowquery.log'
|
58
|
+
* **aurora_state_file** state file that keeps maker information and current & last slowquery log name
|
59
|
+
* **log_fetch_interval** interval time(second) for log fetch (optional)
|
60
|
+
* **aws_access_key_id** AWS access key id. For AWS user IAM instance profile is recommended without using this option (optional)
|
61
|
+
* **aws_secret_access_key** AWS secret access key. For AWS user IAM instance profile is recommended without using this option (optional)
|
62
|
+
* **filename_contains** filter condition for fetching slow query log (optional)
|
24
63
|
|
25
|
-
TODO: Write usage instructions here
|
26
64
|
|
27
65
|
## Development
|
28
66
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-aurora-slowquerylog"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.4"
|
8
8
|
spec.authors = ["Takayuki WATANABE"]
|
9
9
|
spec.email = ["takanabe.w@gmail.com"]
|
10
10
|
|
@@ -86,17 +86,15 @@ module Fluent
|
|
86
86
|
state = load_state
|
87
87
|
if slowlog_rotated?(state)
|
88
88
|
if state["additional_data_pending"]
|
89
|
-
|
90
|
-
fetch_and_emit_log(log_file_name, state["marker"],true)
|
89
|
+
fetch_and_emit_log(@previous_slowlog, state["marker"],true)
|
91
90
|
else
|
92
|
-
|
93
|
-
fetch_and_emit_log(@log_file_name, state["marker"],false)
|
91
|
+
fetch_and_emit_log(@previous_slowlog, state["marker"],false)
|
94
92
|
end
|
95
93
|
else
|
96
|
-
fetch_and_emit_log(@
|
94
|
+
fetch_and_emit_log(@current_slowlog, state["marker"],true)
|
97
95
|
end
|
98
96
|
else
|
99
|
-
fetch_and_emit_log(@
|
97
|
+
fetch_and_emit_log(@current_slowlog, false, true)
|
100
98
|
end
|
101
99
|
end
|
102
100
|
|
@@ -113,7 +111,7 @@ module Fluent
|
|
113
111
|
else
|
114
112
|
fetched_file = @rds_client.download_db_log_file_portion(
|
115
113
|
db_instance_identifier: @db_instance_identifier,
|
116
|
-
log_file_name:
|
114
|
+
log_file_name: log_file_name)
|
117
115
|
save_state(fetched_file)
|
118
116
|
records = parse_fetched_file(fetched_file)
|
119
117
|
emit_slowlogs(records)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-aurora-slowquerylog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takayuki WATANABE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|