Beh01der / node-grok

Regular expression template library for Node.js inspired by logstash grok filter module
ISC License
51 stars 32 forks source link

Options to remove native dependencies? #15

Open radu-gheorghe opened 8 years ago

radu-gheorghe commented 8 years ago

Hello, I was wondering if we can do something to work around the Oniguruma (native) dependency, which may cause install issues on Windows and possibly other platforms.

Specifically, can we use Node's builtin regex engine, or maybe some other library (with no native dependencies) that provides the regex support needed for grok? I assume Oniguruma is needed for the full PCRE support, so one can be sure that copy-pasting rules from Logstash to node-grok work? Or is there another reason?

Thank you in advance.

Beh01der commented 8 years ago

You are exactly right. Oniguruma is used as regex engine for purpose of 100% syntax compatibility with original grok from Logstash. I initially tried to use JavaScript regex engine but it lacks some features (like look-behind constructions). You can read my post about node-grok creation https://memz.co/parsing-log-files-node-js-regex-grok/. I guess, it is possible to create pure-JavaScript library similar to node-grok, but regex syntax would have to be different.

radu-gheorghe commented 8 years ago

Thanks, @Beh01der! Makes perfect sense now.

So if we can find a non-native library that would support all that Oniguruma supports, would you welcome a PR that replaces Oniguruma? Or do you think it should be kept for some other reason (performance...)? Basically the question is whether it's worth trying to find a solution to remove the native dependency.

Beh01der commented 8 years ago

It would be nice to have pure JavaScript solution (to be used in browser for example), but I think it would take too much effort to implement

pekunicki commented 6 years ago

Hi, The newest ECMA supports look-behind construction. Are there any other obstacles to move on JavaScript's regex engine?

https://stackoverflow.com/questions/641407/javascript-negative-lookbehind-equivalent

tbarthelet commented 5 years ago

Is it possible to update the Oniguruma version depency? Otherwise it generates too many build errors.