Skip to content

How to interactively filter a stream of logs using fzf and ripgrep. #4173

Answered by LangLangBart
brpaz asked this question in Q&A
Discussion options

You must be logged in to vote

I am trying to make a function that will stream the contents of a log

fzf is already an interactive grep filter. Simply use docker logs --follow "$container" | fzf --exact and start typing the keyword you're looking for. No need to use ripgrep.

Is there any example or someone can give me some guidelines how can I do this?

There are some examples in the ADVANCED.md12 or on the maintainer's website3.

In a recent PR (#4079), a user demonstrated how to search for a keyword while displaying the line within the stream and its surrounding lines in the preview.

Footnotes

  1. fzf/ADVANCED.md - Log tailing

  2. fzf/ADVANCED.md - Ripgrep integration

  3. junegunn.github.io: Browsing log streams | ju…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brpaz
Comment options

brpaz Jan 17, 2025
Author Sponsor

Answer selected by brpaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants