class Fluent::Plugin::ProxysqlQueryLogInput

Constants

DEFAULT_STORAGE_TYPE

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 46
def initialize
  super
  @paths = []
  @watchers = {}
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 52
def configure(conf)
  super
  @pos_storage = storage_create(usage: 'positions', type: DEFAULT_STORAGE_TYPE, conf: conf)
  @paths = @path.split(',').map{|path|path.strip}
end
refresh_watchers() click to toggle source
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 65
def refresh_watchers
  target_paths = expand_paths
  remove_detached_watcher
  start_watchers(target_paths)
end
remove_detached_watcher() click to toggle source
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 82
def remove_detached_watcher
  @watchers = @watchers.select { |k, v| v.attached? }
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 58
def start
  super

  refresh_watchers
  timer_execute(:in_proxysql_query_log_refresh_watchers, @refresh_interval, &method(:refresh_watchers))
end
start_watchers(paths) click to toggle source
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 71
def start_watchers(paths)

  paths.each do |path|
    unless @watchers.has_key?(path)
      log.debug("start watch: #{path}")
      @watchers[path] = Watcher.new(path, 0, @pos_storage, router, @tag, log)
      event_loop_attach(@watchers[path])
    end
  end
end

Private Instance Methods

expand_paths() click to toggle source
# File lib/fluent/plugin/in_proxysql_query_log.rb, line 88
def expand_paths
  @paths.map do |path|
    if path.include?('*')
      Dir.glob(path)
    else
      path
    end
  end.flatten
end