Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (25 sloc) 0.524 kB
$: << File.join(File.dirname(__FILE__), "lib")
require "grok-pure"
patterns = {}
matches = [
"%{FOO=\\d+}"
]
grok = Grok.new
grok.add_patterns_from_file("patterns/pure-ruby/base")
matches.collect do |m|
grok.compile(m)
end
bytes = 0
time_start = Time.now.to_f
$stdin.each do |line|
m = grok.match(line)
if m
m.each_capture do |key, value|
p key => value
end
#bytes += line.length
break
end
end
#time_end = Time.now.to_f
#puts "parse rate: #{ (bytes / 1024) / (time_end - time_start) }"
Jump to Line
Something went wrong with that request. Please try again.