Grok is a Python port of ruby-grok written by @jordansissel.
Here is the refrerence implementation Link
The project is a work in progress. I have implemented a few base line tests to prove out the api and have started filling these in, but this is no where near working.
Here are things to do:
- Setup test framework
- Setup Python classes for dummy api
- Tox tests for py26, py27, py33, pypy, jython
- Setup Travis-CI
- Grok.add_pattern(name, pattern)
- Grok.add_patterns_from_file(filename)
- Grok.compile(pattern)
- Grok.discover(input)
- Grok.match(text)
- Release to pypi
from grok import Grok
grok = Grok()
grok.add_patterns_from_file('/path/to/my/patterns')
grok.compile('%{GREEDYDATA} - %{NUMBER}')
input = "My Fancy Input - 9999"
print(input)
print("Matches" if grok.matches(input) else "Doens't Match")
For more usage, see the specs/example_spec.py.
$ pip install -r dev-requirements.txt
$ pspec specs