A Python library to parse strings and extract information from structured/unstructured data
Project description
YALP Grok
=========
|build-status| |coverage| |deps| |pypi|
.. |build-status| image:: http://img.shields.io/travis/yalp-log/yalp-grok/master.svg?style=flat
:alt: Build Status
:scale: 100%
:target: https://travis-ci.org/yalp-log/yalp-grok
.. |coverage| image:: http://img.shields.io/coveralls/yalp-log/yalp-grok.svg?style=flat
:alt: Coverage Status
:scale: 100%
:target: https://coveralls.io/r/yalp-log/yalp-grok?branch=master
.. |deps| image:: http://img.shields.io/gemnasium/yalp-log/yalp-grok.svg?style=flat
:alt: Dependency Status
:scale: 100%
:target: https://gemnasium.com/yalp-log/yalp-grok
.. |pypi| image:: http://img.shields.io/pypi/v/yalp_grok.svg?style=flat
:alt: PyPi version
:scale: 100%
:target: https://pypi.python.org/pypi/yalp_grok
Forked from https://github.com/garyelephant/pygrok as it seems to be dead. If
pygrok becomes active again this fork may be closed.
Python implementaion of Jordan Sissel's `Grok`.
Install
-------
.. code-block:: bash
pip install yalp_grok
Basic Usage
-----------
.. code-block:: python
>>> import yalp_grok as pygrok
>>> text = 'gary is male, 25 years old and weighs 68.5 kilograms'
>>> pattern = '%{WORD:name} is %{WORD:gender}, %{NUMBER:age} years old and
weighs %{NUMBER:weight} kilograms'
>>> print pygrok.grok_match(text, pattern)
{'gender': 'male', 'age': '25', 'name': 'gary', 'weight': '68.5'}
Reusing Patterns
----------------
Since compiling a pattern can be time consuming, patterns can be compiled once
and then reused for searching.
.. code-block:: python
>>> import yalp_grok as pygrok
>>> pattern = "%{COMMONAPACHELOG}"
>>> compiled_pattern = pygrok.compile_pattern(pattern)
>>> with open('/var/log/apache/access.log', 'r') as log_file
... matches = [pygrok.grok_search(line, compiled_pattern) for line in log_file]
.. _Grok: https://github.com/jordansissel/grok
=========
|build-status| |coverage| |deps| |pypi|
.. |build-status| image:: http://img.shields.io/travis/yalp-log/yalp-grok/master.svg?style=flat
:alt: Build Status
:scale: 100%
:target: https://travis-ci.org/yalp-log/yalp-grok
.. |coverage| image:: http://img.shields.io/coveralls/yalp-log/yalp-grok.svg?style=flat
:alt: Coverage Status
:scale: 100%
:target: https://coveralls.io/r/yalp-log/yalp-grok?branch=master
.. |deps| image:: http://img.shields.io/gemnasium/yalp-log/yalp-grok.svg?style=flat
:alt: Dependency Status
:scale: 100%
:target: https://gemnasium.com/yalp-log/yalp-grok
.. |pypi| image:: http://img.shields.io/pypi/v/yalp_grok.svg?style=flat
:alt: PyPi version
:scale: 100%
:target: https://pypi.python.org/pypi/yalp_grok
Forked from https://github.com/garyelephant/pygrok as it seems to be dead. If
pygrok becomes active again this fork may be closed.
Python implementaion of Jordan Sissel's `Grok`.
Install
-------
.. code-block:: bash
pip install yalp_grok
Basic Usage
-----------
.. code-block:: python
>>> import yalp_grok as pygrok
>>> text = 'gary is male, 25 years old and weighs 68.5 kilograms'
>>> pattern = '%{WORD:name} is %{WORD:gender}, %{NUMBER:age} years old and
weighs %{NUMBER:weight} kilograms'
>>> print pygrok.grok_match(text, pattern)
{'gender': 'male', 'age': '25', 'name': 'gary', 'weight': '68.5'}
Reusing Patterns
----------------
Since compiling a pattern can be time consuming, patterns can be compiled once
and then reused for searching.
.. code-block:: python
>>> import yalp_grok as pygrok
>>> pattern = "%{COMMONAPACHELOG}"
>>> compiled_pattern = pygrok.compile_pattern(pattern)
>>> with open('/var/log/apache/access.log', 'r') as log_file
... matches = [pygrok.grok_search(line, compiled_pattern) for line in log_file]
.. _Grok: https://github.com/jordansissel/grok
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yalp_grok-0.3.tar.gz
(15.3 kB
view details)
Built Distribution
yalp_grok-0.3-py2-none-any.whl
(15.9 kB
view details)
File details
Details for the file yalp_grok-0.3.tar.gz
.
File metadata
- Download URL: yalp_grok-0.3.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1f84883acaa3317adbb2c52031c2161798ee64a557425adc39aaa8bb8d53a681
|
|
MD5 |
a0b8ed1b0cdd4b097ac3610b708eccfe
|
|
BLAKE2b-256 |
6e93266d77b6e41586bddd69a19a2f3761747e2c0457fcc0efa5e12e88174d01
|
File details
Details for the file yalp_grok-0.3-py2-none-any.whl
.
File metadata
- Download URL: yalp_grok-0.3-py2-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
57ed83cd3eaef613da5b9ef442decd8e06b62707edcac00dac301a3115befeaa
|
|
MD5 |
199a824e3a6d7fc0d8fb7f8c34ea8374
|
|
BLAKE2b-256 |
c90244716d0d0e2cc15de3f623efb5938116da1cbf272e227aadddc5c2d737b0
|