Created
November 17, 2014 14:38
-
-
Save sokratisg/7ec540cdeeb839f36359 to your computer and use it in GitHub Desktop.
grok tester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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