class Fluent::ElasticsearchSlowQueryLogParser
Constants
- REGEXP
- TIME_FORMAT
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/parser_es_slow_query.rb, line 8 def initialize super @time_parser = TextParser::TimeParser.new(TIME_FORMAT) @mutex = Mutex.new end
Public Instance Methods
parse(text) { |nil, nil| ... }
click to toggle source
# File lib/fluent/plugin/parser_es_slow_query.rb, line 18 def parse(text) m = REGEXP.match(text) unless m if block_given? yield nil, nil return else return nil, nil end end shard = m['shard'].to_i took_millis = m['took_millis'].to_i total_shards = m['total_shards'].to_i time = m['time'] time = @mutex.synchronize { @time_parser.parse(time) } record = { 'severity' => m['severity'], 'source' => m['source'], 'node' => m['node'], 'index' => m['index'], 'shard' => shard, 'took' => m['took'], 'took_millis' => took_millis, 'types' => m['types'], 'stats' => m['stats'], 'search_type' => m['search_type'], 'total_shards' => total_shards, 'source_body' => m['source_body'], 'extra_source' => m['extra_source'] } record["time"] = m['time'] if @keep_time_key if block_given? yield time, record else return time, record end end
patterns()
click to toggle source
# File lib/fluent/plugin/parser_es_slow_query.rb, line 14 def patterns {'format' => REGEXP, 'time_format' => TIME_FORMAT} end