Skip to content

Commit bdc9091

Browse files
author
Paulo Remoli
committed
update docs for regex filter
1 parent 163b256 commit bdc9091

4 files changed

Lines changed: 29 additions & 23 deletions

File tree

docs/src/filtering/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Filters are the primary way to narrow the log view. They are layered: include pa
2020
**No filters:** All lines are shown.
2121

2222
Both filter types support:
23-
- **Literal strings** — fast multi-pattern matching via Aho-Corasick
24-
- **Regular expressions** — full regex syntax via the `regex` crate, opt-in with `--regex` / `-r`
23+
- **Text search** — fast multi-pattern matching
24+
- **Regular expressions** — full regex syntax, opt-in with `--regex` / `-r`
2525

2626
## Filter Persistence
2727

docs/src/filtering/text-filters.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,33 @@ Text filters match against the raw content of each log line.
1414
:exclude <pattern> # hide lines matching pattern
1515
```
1616

17-
## Pattern Matching
17+
## Text Search
1818

19-
logana uses two matching strategies, selected explicitly:
19+
The default mode. Fast multi-pattern scanning. Case-sensitive. Multi-word patterns work without quotes.
2020

21-
**Literal matching** (default) — fast multi-pattern scanning via Aho-Corasick. Case-sensitive.
21+
```sh
22+
:filter ERROR
23+
:filter connection refused
24+
:filter 500 Internal Server Error
25+
:filter database connection pool exhausted
26+
```
27+
28+
## Regex Filters
2229

23-
**Regex matching** — opt-in via `--regex` / `-r`. Uses the `regex` crate with full regex syntax.
30+
Opt in with `--regex` / `-r`. Supports full regex syntax. Words after `-r` are joined, so spaces in the pattern do not need quoting.
2431

2532
```sh
26-
:filter ERROR # literal — fast
27-
:filter connection refused # multi-word literal (no quotes needed)
28-
:filter -r "ERR(OR)?" # regex — matches ERR or ERROR
29-
:filter -r "\d{3} \d+" # regex — HTTP status + bytes
30-
:filter -r "^2024-" # regex — lines starting with date
33+
:filter -r (ERROR|WARN) # errors and warnings together
34+
:filter -r (timeout|connection refused) # any connectivity failure
35+
:filter -r authentication failed.*user # auth failures with user context
36+
:filter -r response time: [5-9]\d{3}ms # slow responses over 5 seconds
3137
```
3238

33-
> **Flag ordering:** Options like `--regex`, `--fg`, `--bg`, and `-l` must be placed **before** the pattern. Everything after the first pattern word is treated as part of the pattern.
39+
> **Flag ordering:** Options (`-r`, `--fg`, `--bg`, `-l`, `--field`) must appear **before** the pattern. Everything after the first pattern word is part of the pattern.
3440
>
3541
> ```sh
36-
> :filter --fg red -r "timeout.*retry" # correct
37-
> :filter "timeout.*retry" --fg red # incorrect — "--fg" becomes part of the pattern
42+
> :filter --fg red -r timeout.*retry # correct
43+
> :filter timeout.*retry --fg red # wrong — "--fg" becomes part of the pattern
3844
> ```
3945
4046
## Multiple Filters

docs/src/search.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Press `/` or `?` to open the search bar at the bottom of the screen. Type your q
2020

2121
## Pattern Syntax
2222

23-
Search uses full regex syntax (via the `regex` crate). Examples:
23+
Search uses full regex syntax. Examples:
2424

2525
```
26-
/ERROR plain literal
27-
/connection.*refused regex
28-
/\d{3} \d+ HTTP status + bytes
29-
/^2024-03 lines starting with date prefix
26+
/NullPointerException plain text
27+
/user 42 .* failed regex — activity for a specific user
28+
/POST /api/orders.* 5\d\d regex — failed order requests
29+
/^2024-06-15T14 lines from a specific hour
3030
```
3131

3232
## Case Sensitivity

src/commands/info.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ pub struct CommandInfo {
77
pub const COMMANDS: &[CommandInfo] = &[
88
CommandInfo {
99
name: "filter",
10-
usage: "filter [--field] [-l] [--fg <color>] [--bg <color>] <pattern>",
11-
description: "Add an include filter. With --field, pattern is key=value scoped to a parsed field. e.g. filter --fg Red error, filter --field level=error, filter --field component=auth",
10+
usage: "filter [-r] [-l] [--fg <color>] [--bg <color>] [--field <key>=<value>] <pattern>",
11+
description: "Add an include filter. e.g. filter ERROR, filter connection refused, filter -r \"ERR(OR)?\", filter --field level=error",
1212
},
1313
CommandInfo {
1414
name: "exclude",
15-
usage: "exclude [--field] <pattern>",
16-
description: "Add an exclude filter. With --field, pattern is key=value scoped to a parsed field. e.g. exclude debug, exclude --field level=debug",
15+
usage: "exclude [-r] [--field <key>=<value>] <pattern>",
16+
description: "Add an exclude filter. e.g. exclude debug, exclude connection refused, exclude -r \"health.?check\", exclude --field level=debug",
1717
},
1818
CommandInfo {
1919
name: "set-color",

0 commit comments

Comments
 (0)