# Docker Logs Grep

Filter docker compose logs with grep-style context, invert and dedupe modes.

## URL

https://ilham.dev/tools/docker-logs-grep/

## What It Does

Paste the output of docker compose logs and filter it like grep. Match with context (the equivalent of grep -C, with separate before and after counts), show matching lines only, invert the match, count matches, or list unique matching lines. Context groups are separated by "--" and line numbers use ":" for a match and "-" for context, so the output looks like grep -n -C. Everything runs in the page, so log contents never leave the browser.

## Features

- Runs in the browser
- No login required

## Input

text input.

## Output

text output.

## Privacy

Processing happens locally in the browser.

No input data is uploaded to ilham.dev.

- Requires login: false
- Requires API key: false
- Stores user data: false


## Examples

- How do I get 10 lines before and 5 lines after a match?
- What is the difference between Regex and plain search?
- Can I dedupe a noisy log?




## Questions

### How do I get 10 lines before and 5 lines after a match?

Leave the grep type on Match with context, set Lines before to 10 and Lines after to 5. That is the same as grep -B 10 -A 5, and grep -C would use the larger of the two.

### What is the difference between Regex and plain search?

With Regex checked, the pattern is a JavaScript regular expression, so error|timeout matches either word and ^api matches the start of a line. With Regex unchecked every character is literal, so a dot matches only a dot.

### Can I dedupe a noisy log?

Yes. Use the Unique matching lines type, which behaves like grep ... | sort | uniq -c and prefixes each distinct line with how many times it appeared. A pattern of . matches every line, so it can dedupe the whole file.

