Skip to content

Commit

Permalink
docs: bench cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Dec 7, 2024
1 parent c683909 commit 0916267
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,22 @@ go-watch-logs --file-path=my.log --match='HTTP/1.1" 50' --every=60
path to store db file (default "/Users/pulkit.kathuria/.go-watch-logs.db")
-every uint
run every n seconds (0 to run once)
-f string
(short for --file-path) full path to the log file
-file-path string
full path to the log file
-file-paths-cap int
max number of file paths to watch (default 100)
-health-check-every uint
run health check every n seconds (0 to disable) (default 86400)
run health check every n seconds (0 to disable)
-ignore string
regex for ignoring errors (empty to ignore none)
-log-level int
log level (0=info, 1=debug)
log level (0=info, -4=debug, 4=warn, 8=error)
-match string
regex for matching errors (empty to match all lines)
-mem-limit int
memory limit in MB (0 to disable) (default 100)
-min int
on minimum num of matches, it should notify (default 1)
-ms-teams-hook string
Expand All @@ -82,6 +86,14 @@ go-watch-logs --file-path=my.log --match='HTTP/1.1" 50' --every=60
run this shell command after every scan when min errors are found
-proxy string
http proxy for webhooks
-test
Quickly test paths or regex

echo test123 | go-watch-logs --match=123 --test
# will test if the input matches the regex
go-watch-logs --file-path=./ssl_access.*log --test
# will test if the file paths are found and list them

-version
```

Expand All @@ -91,11 +103,19 @@ go-watch-logs --file-path=my.log --match='HTTP/1.1" 50' --every=60
## Performance Notes

```sh
$ go test -bench=. ./... -benchmem
BenchmarkReadFileAndMatchErrors-10 969 1173870 ns/op 12920 B/op 146 allocs/op
BenchmarkLoadAndSaveState-10 5296 230536 ns/op 9179 B/op 180 allocs/op
BenchmarkLogRotation-10 1036 1175464 ns/op 12930 B/op 146 allocs/op
```

## Development Notes

```sh
go run main.go -file-path="testdata/*.log" --every=3
go test ./...
```


## CHANGE LOG

Expand Down

0 comments on commit 0916267

Please sign in to comment.