require 'flydata/fluent-plugins/mysql/binlog_query_handler' module Mysql class DdlQueryHandler < BinlogQueryHandler DDL_TABLE_QUERY = /^(?:(?:ALTER|CREATE|DROP|RENAME) +(?:\w+ +)*TABLE +([^ ]+)|TRUNCATE +(?:TABLE +)?([^ ]+))/i def acceptable_db?(record) db_name = record["db_name"] if DDL_TABLE_QUERY =~ record["normalized_query"] table_name_in_query = $1 ? $1 : $2 if (idx = table_name_in_query.index(".")) db_name = table_name_in_query[0...idx].tr("`", "") end end supported_database == db_name end end end