Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
grok tester
#!/usr/bin/env ruby
require 'rubygems'
require 'grok-pure'
require 'pp'
grok = Grok.new
grok.add_patterns_from_file("grok-patterns")
pattern = 'your_grok_pattern'
grok.compile(pattern)
puts "PATTERN: #{pattern}"
while a = gets
puts "IN: #{a}"
match = grok.match(a)
if match
puts "MATCH:"
pp match.captures
else
puts "No Match."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.