Simple CLI and TUI for browsing Cloudwatch logs in the terminal.
Aims to be as simple as possible but no simpler.
Using Go:
go install github.com/derricw/cwl@latestUsing the install script:
curl -sL https://api.github.com/repos/derricw/cwl/releases/latest | \
grep "browser_download_url.*$(uname -s | tr '[A-Z]' '[a-z]').*$(uname -m | sed 's/x86_64/amd64/').tar.gz" | \
cut -d '"' -f 4 | \
xargs curl -sL | \
tar xz && sudo mv cwl /usr/local/bin/Or download the binary from the releases page and place it in your PATH.
List log groups:
cwl groupsList streams for a group:
cwl streams /my/log/groupWrite 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_12345Tail a log stream:
cwl events -f arn:aws:logs:us-west-2:12345657890:log-group:/aws/batch/job:log-stream:my_batch_job_12345Use a specific AWS profile (otherwise uses default credential chain):
cwl -p testProfile groupsQuery a log group using cloudwatch query language:
cwl query /my/log/group -q "fields @timestamp, @message | sort @timestamp desc | limit 5"Omit the group 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 eventsStart searching many log streams for a keyword and dump to file:
cwl streams /aws/batch/job | cwl events | grep "ERROR" > errors.logUse with no arguments to start a TUI:
cwl