Sha256: 468f3b6ccfd52d0cdcc1e7866921fec3a09eddceb9beec71e3862fef6241a680
Contents?: true
Size: 767 Bytes
Versions: 5
Compression:
Stored size: 767 Bytes
Contents
require 'json' class ParseConnection < Rodimus::Step attr_reader :current_event def handle_output(row); nil; end def process_row(row) if row =~ /^Started/ parse_new_connection(row) elsif row =~ /^Completed/ parse_end_connection(row) outgoing.puts(current_event.to_json) end end private def parse_new_connection(row) @current_event = {} match_data = row.match(/^Started (\w+) \"(.+)\" for (.+) at (.+)$/) current_event[:verb] = match_data[1] current_event[:route] = match_data[2] current_event[:ip] = match_data[3] current_event[:time] = match_data[4] end def parse_end_connection(row) match_data = row.match(/^Completed ([0-9]+)/) current_event[:response] = match_data[1] end end
Version data entries
5 entries across 5 versions & 1 rubygems