Simple CLI and TUI for browsing Cloudwatch logs in the terminal.
Aims to be as simple as possible but no simpler.
go install github.com/derricw/cwl@latest
List log groups:
cwl groups
List streams for a group:
cwl streams /my/log/group
Write events from a stream to stdout:
cwl events arn:aws:logs:us-west-2:12345657890:log-group:/aws/batch/job:log-stream:my_batch_job_12345
Use a specific AWS profile (otherwise uses default credential chain):
cwl -p testProfile groups
Query a log group using cloudwatch query language:
cwl query /my/log/group -q "fields @timestamp, @message | sort @timestamp desc | limit 5"
Omit the arg to query all log groups:
cwl query -q "fields @timestamp, @message | sort @timestamp desc | limit 5"
Each command can read input from stdin, so you can compose with other tools like fzf
or grep
:
cwl streams /aws/batch/job | fzf | cwl events
Start searching many log streams for a keyword and dump to file:
cwl streams /aws/batch/job | cwl events | grep "ERROR" > errors.log
Use with no arguments to start a TUI:
cwl