Power log Search


Userlevel 5
Badge +3
  • Comes here often
  • 13 comments

Hi all, I’ve been using an app called “ripgrep” for a while now and wanted to share it with the community. 

https://github.com/BurntSushi/ripgrep

“ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern.”

ripgrep is written in Rust which is “blazingly fast” for this type of operation. I found this article very interesting on the subject of benchmarking 

https://blog.burntsushi.net/ripgrep/

Finding the specific file or files where something occurred can be tricky, but ripgrep makes it easy with a simple regex pattern.

rg "^.*?\b13.02.2023\b.*?\bError\b.*?$"

It provides each instance that matches the expression under the file's name. 

It also allows you to use flags to alter the output; the most useful I’ve found are the -A, -B and -C flags. 

-A Provides a number of lines before the match

-B Provides a number of lines after the match

-C Provide a number of lines before and after the match

Many other flags can be used, including a flag that recursively looks through zipped folders (unsurprisingly, that is the -z flag)

You can also show the files where the match occurred with the -l flag, which helps you hone in on the specific file you need to find.

 

I hope it helps someone!

Ed


6 comments

Userlevel 7
Badge +20

This looks like a very interesting tool for sure and as in your example can help crawl the Veeam logs. Looking forward to testing this out.  Thanks for sharing. 👍

Userlevel 7
Badge +6

Thanks for the suggestion.  I don’t have a lot of linux in place, but this is a cool looking suggestion if I do get some more.

Userlevel 5
Badge +3

@dloseke it works on Windows too. The above example was running on the VBR server.

Userlevel 7
Badge +20

Thanks for the suggestion.  I don’t have a lot of linux in place, but this is a cool looking suggestion if I do get some more.

I used Chocolatey to install it on windows and it does work as noted.

Userlevel 7
Badge +6

Oh geez...don’t know how I didn’t notice it was on Windows...I saw grep and thought linux I guess….

Userlevel 7
Badge +17

Hmm..interesting @EdxH . I’ll try & check it out. Thank you for the post!

Comment