CLI for logs based on top of ClickHouse
$ go get github.com/YuriyNasretdinov/logscli
You need to have a ClickHouse table with logs that you would like to view that has the following fields:
time DateTime, -- event timestamp
millis UInt16, -- event timestamp milliseconds (stored separately)
Also, by default, the review_body
field is assumed to have the text field as the dataset that the author used to develop this utility is based on https://s3.amazonaws.com/amazon-reviews-pds/tsv/index.txt .
The tool supports basic grep parameters, such as -E
(regex search), -F
(fixed string search), -A
, -B
, -C
(show matching lines in context). Also there is a -tailf
mode.
It connects to ClickHouse server and sends queries there (localhost:8123
is used as default).
$ logscli -F 'walmart' | less
$ logscli -F terrible -limit 10
$ logscli -F terrible | head -n 10
$ logscli -E 'times [0-9]' -where="vine='Y' AND star_rating>4" | less
$ logscli -F 'panic' -C 3 | less
$ logscli -F '5-star' -tailf