lazydocker icon indicating copy to clipboard operation
lazydocker copied to clipboard

Filter Container Log Output

Open mpcarolin opened this issue 7 months ago • 0 comments

Hi, I have a feature request that I am willing to implement.

Is your feature request related to a problem? Please describe. I frequently desire a way to search or filter for a particular keyword in the container log output. I know of no current support for this feature, and so I always revert to exiting lazydocker and grepping the output of docker logs.

I think this would be particularly useful for devs like me: I usually have a dozen or more containers running locally, and when I have to debug issues with our microservices, I often need to search for keywords across 3 or more of those containers.

Describe the solution you'd like To maintain consistency with the filter that already exists in the any of the side list panes, I suggest the / keyboard shortcut be used. When the Logs tab is focused (either for a docker service or standalone container), pressing / would enable the filter: input at the bottom of the screen. As you type, the output would be filtered in real time for any lines that contain the search query. Other existing filter behavior would be reused as well, like the enter and escape keys.

I am open to different ideas.

Describe alternatives you've considered

  • docker logs <container name> | grep <pattern>
    • This is tedious
  • docker compose logs | grep <pattern>
    • Slow and noisy
  • Updating the logs command in the user config so that when I type m it searches for my keyword.
    • Not at all practical

I like lazydocker and prefer to stay in its context when I'm already there.

mpcarolin avatar Jun 03 '25 23:06 mpcarolin