Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pygrok New API #20

Closed
garyelephant opened this issue Jun 6, 2016 · 1 comment
Closed

Pygrok New API #20

garyelephant opened this issue Jun 6, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@garyelephant
Copy link
Owner

garyelephant commented Jun 6, 2016

From v1.0, Pygrok will make big performance enhancement and the API will change, probably new API looks like this:

from pygrok import Grok

pattern = 'load average: %{NUMBER:load_1:float}, %{NUMBER:load_2:float}, %{NUMBER:load_3:float}'

text = 'load average: 1.88, 1.73, 1.49'

grok = Grok(pattern)

m = grok.match(text)

This will output parsed data:

{'load_1': 1.88, 'load_2': 1.73, 'load_3': 1.49}

With precompiled regex pattern inside, you can invoke grok.match thousands of time without too much performance loss.This will address #3.

@garyelephant
Copy link
Owner Author

garyelephant commented Sep 24, 2016

Pygrok 1.0.0 is available in pip now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant