lib/dexter/processor.rb in pgdexter-0.4.2 vs lib/dexter/processor.rb in pgdexter-0.4.3
- old
+ new
@@ -9,30 +9,37 @@
@indexer = Indexer.new(options)
@log_parser =
if @logfile == :pg_stat_activity
PgStatActivityParser.new(@indexer, @collector)
+ elsif @logfile == :log_table
+ if options[:input_format] == "csv"
+ CsvLogTableParser.new(@indexer, @collector)
+ else
+ StderrLogTableParser.new(@indexer, @collector)
+ end
elsif options[:input_format] == "csv"
CsvLogParser.new(logfile, @collector)
elsif options[:input_format] == "json"
JsonLogParser.new(logfile, @collector)
elsif options[:input_format] == "sql"
SqlLogParser.new(logfile, @collector)
else
- LogParser.new(logfile, @collector)
+ StderrLogParser.new(logfile, @collector)
end
@starting_interval = 3
@interval = options[:interval]
+ @log_parser.once = options[:once]
@mutex = Mutex.new
@last_checked_at = {}
log "Started"
end
def perform
- if [STDIN, :pg_stat_activity].include?(@logfile)
+ if [STDIN, :pg_stat_activity, :log_table].include?(@logfile) && !@log_parser.once
Thread.abort_on_exception = true
Thread.new do
sleep(@starting_interval)
loop do
begin