fluent-plugin-rds-mysql-log 0.1.13 → 0.1.14
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/fluent-plugin-rds-mysql-log.gemspec +1 -1
- data/lib/fluent/plugin/in_rds_mysql_log.rb +17 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54c991b20601918e984e3e2dee1497ec124c34f6b863b2a8471a7374f7f9348c
|
4
|
+
data.tar.gz: c1d204feef35cc76be4eddcd5170a8574557e426032c52b35b633530de409e8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876326aab54f3721db478d99099ac11f19ae9f4027b5b05508764d7b67815993662325cbed183b35153240a808e21d797ed82f60acbf8efdbbbbfab166be44f7
|
7
|
+
data.tar.gz: 7f48a11eb591a1439dadd726bedfc1207669bca3f33839fe658de11c972bb56567342d48941dd35e793ee993e39e5ed59cf7a75b7a5e716f8e69b1beace23191
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'fluent-plugin-rds-mysql-log'
|
8
|
-
spec.version = '0.1.
|
8
|
+
spec.version = '0.1.14'
|
9
9
|
spec.authors = ['Junaid Ali']
|
10
10
|
spec.email = ['jonnie36@yahoo.com']
|
11
11
|
spec.summary = 'Amazon RDS Mysql logs input plugin'
|
@@ -8,6 +8,7 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input
|
|
8
8
|
helpers :timer
|
9
9
|
|
10
10
|
LOG_REGEXP = /^(?:(?<audit_logs>(?<timestamp>(\d{8})\s(\d{2}:\d{2}:\d{2})?),(?<serverhost>[^,]+?),(?<username>[^,]+?),(?<host>[^,]+?),(?<connectionid>[^,]+?),(?<queryid>[^,]+?),(?<operation>[^,]+?),(?<database>[^,]+?),'(?<query>.*?)',(?<retcode>[0-9]?),(?:,)?)|(?<other_logs>(?<time>(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}\.\d+Z)?)\s(?<thread_id>\d+?)\s\[(?<severity>([^\]]+)?)\]\s\[(?<error_code>([^\]]+)?)\]\s\[(?<subsystem>([^\]]+)?)\]\s((?<message>.+)?)))$/m
|
11
|
+
AUDIT_LOG_PATTERN = /server_audit\.log(\.\d+)?$/i
|
11
12
|
|
12
13
|
config_param :access_key_id, :string, :default => nil
|
13
14
|
config_param :secret_access_key, :string, :default => nil
|
@@ -75,6 +76,10 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input
|
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
79
|
+
def is_audit_logs?
|
80
|
+
@pos_info.keys.any? { |log_file_name| log_file_name =~ AUDIT_LOG_PATTERN }
|
81
|
+
end
|
82
|
+
|
78
83
|
def should_track_marker?(log_file_name)
|
79
84
|
return false if log_file_name == "audit/server_audit.log"
|
80
85
|
|
@@ -117,11 +122,18 @@ class Fluent::Plugin::RdsMysqlLogInput < Fluent::Plugin::Input
|
|
117
122
|
begin
|
118
123
|
log.debug "get logfile-list from rds: db_instance_identifier=#{@db_instance_identifier}, pos_last_written_timestamp=#{@pos_last_written_timestamp}"
|
119
124
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
+
if is_audit_logs?
|
126
|
+
@rds.describe_db_log_files(
|
127
|
+
db_instance_identifier: @db_instance_identifier,
|
128
|
+
max_records: 10
|
129
|
+
)
|
130
|
+
else
|
131
|
+
@rds.describe_db_log_files(
|
132
|
+
db_instance_identifier: @db_instance_identifier,
|
133
|
+
file_last_written: @pos_last_written_timestamp,
|
134
|
+
max_records: 10,
|
135
|
+
)
|
136
|
+
end
|
125
137
|
rescue => e
|
126
138
|
log.warn "RDS Client describe_db_log_files error occurred: #{e.message}"
|
127
139
|
end
|