3 ms·
Is there anyway to make use of grok on the command line like the post does with rosie patterns? I rather like the idea of `| grep 'net.ipv4'`
by eutropia 8y ago
Is there anyway to make use of grok on the command line like the post does with rosie patterns? I rather like the idea of `| grep 'net.ipv4'`
- busterarm 8y agoI wish. I think the closest that you can get is to run Logstash locally with the stdout output plugin. You'll have to do some work with the logstash config to set up your grok input filters each time, but it should give you what you want otherwise.
- aequitas 8y agoGrok is implemented in other languages too. For example https://github.com/garyelephant/pygrok/ https://github.com/garyelephant/pygrok/ It makes developing and unit testing Logstash Grok patterns a lot quicker compared to spinning up a full Logstash instance for every line of code changed.
- Twirrim 8y agofor things like that, I write bash aliases. If you'll excuse the useless use of cat: $ cat /etc/hosts | netgrep 127.0.0.1 255.255.255.255 .. ..