Class: Fluent::Plugin::RdsMysqlLogInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::RdsMysqlLogInput
- Defined in:
- lib/fluent/plugin/in_rds_mysql_log.rb
Defined Under Namespace
Classes: TimerWatcher
Constant Summary collapse
- 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
- AUDIT_LOG_PATTERN =
/server_audit\.log(\.\d+)?$/i
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fluent/plugin/in_rds_mysql_log.rb', line 21 def configure(conf) super raise Fluent::ConfigError.new("region is required") unless @region if !has_iam_role? raise Fluent::ConfigError.new("access_key_id is required") if @access_key_id.nil? raise Fluent::ConfigError.new("secret_access_key is required") if @secret_access_key.nil? end raise Fluent::ConfigError.new("db_instance_identifier is required") unless @db_instance_identifier raise Fluent::ConfigError.new("pos_file is required") unless @pos_file raise Fluent::ConfigError.new("refresh_interval is required") unless @refresh_interval raise Fluent::ConfigError.new("tag is required") unless @tag begin = { :region => @region, } if @access_key_id && @secret_access_key [:access_key_id] = @access_key_id [:secret_access_key] = @secret_access_key end @rds = Aws::RDS::Client.new() rescue => e log.warn "RDS Client error occurred: #{e.}" end end |
#shutdown ⇒ Object
57 58 59 |
# File 'lib/fluent/plugin/in_rds_mysql_log.rb', line 57 def shutdown super end |
#start ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/fluent/plugin/in_rds_mysql_log.rb', line 48 def start super # pos file touch File.open(@pos_file, File::RDWR|File::CREAT).close timer_execute(:poll_logs, @refresh_interval, repeat: true, &method(:input)) end |