cjslack / grok-debugger

MIT License
135 stars 31 forks source link

Support for custom patterns #5

Closed albgus closed 1 year ago

albgus commented 1 year ago

Really nice tool, especially the syntax highlighting makes it a lot easier to work with than many other Grok tools.

Something I do miss though is the ability to load custom patterns. I have a lot of patterns in Logstash that are broken up in smaller sub patterns to make debugging them easier. It would be really nice to have a free form text field below the Samples field that allowed loading extra Grok patterns extending the pre-defined ones.

baudneo commented 1 year ago

Absolutely agree, custom patterns will make this perfect.

cjslack commented 1 year ago

Thanks, I appreciate the feedback. I currently load in the patterns by fetching them from .txt files like this one: https://grokdebugger.com/patterns/grok-patterns.txt. The format is just PATTERN_NAME pattern

I could implement a custom patterns feature by adding a button to upload a pattern set that follows the same format. Do you think that would be a good solution? Otherwise, I would probably do a modal form, similar to the save/load pattern feature I currently have. I lean against adding another box below the samples field as I am trying to keep the initial UI as simple as possible

baudneo commented 1 year ago

Maybe try all 3 and see which one gets the best feedback? I would vote towards a text box for ease of editing the patterns while building complex patterns but, maybe a modal wouldn't be so bad if it can be hotkeyed?

The only request I have is allowing custom patterns to be used in custom patterns as long as they are declared in logical order.

MYPATT bar
OTHERPATT foo %{MYPATT}

Thank you for your work!

cjslack commented 1 year ago

Hi again @albgus @baudneo, I've replaced the old save/load patterns feature with the custom patterns feature you asked for. It works in a similar way. I've also added support for downloading custom patterns from a URL. You'll also notice I've added a bunch more pattern sets and replaced the pattern set list with a multi-select input box.

Please let me know if you have any feedback or notice any bugs. Thanks

baudneo commented 1 year ago

Works great btw.