1 unstable release
0.1.0 | May 11, 2024 |
---|
#4 in #log-viewer
182 downloads per month
33KB
558 lines
AWS CloudWatch log CLI viewer
Axe is another tool to get logs from AWS CloudWatch.
Features
- multiple ways to define datetime range,
- build-in regex support,
- aliases support.
Installation
The easiest option is to install cargo through rustup and then run cargo install cw-axe
.
Usage
Global options
-p, --prodile AWS profile
-c, --config-path <CONFIG_PATH>
Commands
log show logs
groups show log groups
streams show log group streams
alias add or rewrite alias, use with with -- after alias to pass args
help Print this message or the help of the given subcommand(s)
Log
Arguments:
<GROUP> group name
<STREAM> stream name
Options:
-s, --start <START>
start time, the time can be defines as
* RFC 3339, ex:
* 2024-01-02T03:04:05.678Z
* 2024-01-02T03:04:05+1
* offset from now, in days(d), hours(h), minutes(m), seconds(s) ex:
* 10m - 10 minutes
* 100 - 100 seconds
* 1m30s
* local time of day, ex:
* 12:34
* UTC time of day, ex:
* 12:34Z
* [default: 60m]
-e, --end <END>
end time, format is the same as for start
-l, --length <LENGTH>
either length or end is used, the format is same as offset for start
--chunk-size <CHUNK_SIZE>
number records in a chunk, maximum is 10k [default: 1000]
-f, --filter <FILTER>
AWS CloudWatch filter https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
Examples:
* 'A B' - the log has to contain A and B
* '"A B"' - exact match
* '?A ?B' - matches with A or B
* 'A -B' - matches with lines contains A and no B
* '%\s[A-Z]{4}\s%' - regex
-r, --message-regexp <MESSAGE_REGEXP>
replace regexp
'<delimiter char><regexp><the same delimiter char><replacement>'
example: '/(\d{4} [^|]+/$1'
-d, --datetime-format <DATETIME_FORMAT>
ouput datetime format https://docs.rs/chrono/latest/chrono/format/strftime/index.html [default: "%d%b %H:%M:%S%.3f|"]
Alias
When you want to save your command just create an alias the next way.
For cw-axe -p my-profile log my-group my-setream -r '#^2024#24'
insert alias <name> --
after cw-axe
: cw-axe alias my-alias -- -p my-profile log my-group my-setream -r '#^2024#24
.
And now you can just use cw-axe my-alias
.
Known bugs:
- AWS CloudWatch filter is not always working correctly, sometimes it misses some commands, but it's on the AWS side, so no way to fix it except get all events and grep.
Dependencies
~25–34MB
~535K SLoC