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
pip install yalp_grok
Basic Usage
>>> 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.
>>> 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]
Metadata
Release files for yalp_grok 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| yalp_grok-0.3.tar.gz | 15.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yalp_grok-0.3-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 31.2 kB
Release files / yalp_grok-0.3.tar.gz
| Download URL | yalp_grok-0.3.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f84883acaa3317adbb2c52031c2161798ee64a557425adc39aaa8bb8d53a681
|
|
BLAKE2b-256 checksum How to use checksums |
6e93266d77b6e41586bddd69a19a2f3761747e2c0457fcc0efa5e12e88174d01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / yalp_grok-0.3-py2-none-any.whl
| Download URL | yalp_grok-0.3-py2-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
57ed83cd3eaef613da5b9ef442decd8e06b62707edcac00dac301a3115befeaa
|
|
BLAKE2b-256 checksum How to use checksums |
c90244716d0d0e2cc15de3f623efb5938116da1cbf272e227aadddc5c2d737b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for yalp_grok 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.