Registry / data / pygrok

pygrok

JSON →
library1.0.0pypypi✓ verified 87d ago

A Python library to parse strings and extract information from structured/unstructured data using Grok patterns (similar to logstash grok). Current version is 1.0.0, with a major API redesign in v1.0.0 that breaks compatibility with older versions. Release cadence is sporadic, with most updates in 2015-2016.

pip install pygrok
INSTALL
IMPORT
SIG · PYGROK
P
pygrok
datapythonv1.0.0
Install
3.4s avg
Import
90ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.096s · 22MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.084s · 23MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Grok
from pygrok import Grok
from pygrok.grok import Grok
In v1.0.0, the main class is exported directly from pygrok.

Basic usage: compile a pattern and match against a string.

from pygrok import Grok grok = Grok('%{IP:client_ip}') text = '192.168.0.1' print(grok.match(text))
Debug
Known issues
breakingv1.0.0 introduced a completely new API. Old code using `Grok(pattern)` and `grok.match(text)` is no longer compatible. The new API uses `Grok('%{PATTERN:name}')` and returns a dict from `match()`. No support for `%{PATTERN}` (without a field name) in v1.0.0? Actually v1.0.0 still supports it. But the class `Grok` is now the main entry point.
fix
Upgrade to v1.0.0 and use `from pygrok import Grok`.
affects: <1.0.0
deprecatedOlder versions (0.x) used `pygrok.grok.Grok`. This import path is removed in v1.0.0.
fix
Change to `from pygrok import Grok`.
affects: <1.0.0
gotchaThe `match()` method returns `None` if no match, not an empty dict. Always check for `None` before accessing results.
fix
Use `result = grok.match(text); if result: ...`.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pygrok' has no attribute 'Grok'
Using wrong import path in v1.0.0; old code uses `from pygrok.grok import Grok`.
fix
Use `from pygrok import Grok`.
ImportError: No module named pygrok.grok
Installation of old version or using outdated import with v1.0.0.
fix
Reinstall with `pip install pygrok` (v1.0.0) and use `from pygrok import Grok`.
Upgrade
Version history
1.0.0latest on PyPI · released Sep 24, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
2
Resources
pygrok — pip install pygrok · libregistry