A fast, terminal-based viewer for AWS CloudWatch logs with real-time streaming and powerful search capabilities.
- 🚀 Real-time log streaming - See new logs as they arrive
- 🔍 Fast search - Find logs instantly with regex support
- 🎨 Dual display modes - Switch between raw and formatted views
- 📱 Responsive UI - Smooth scrolling and navigation
- 💾 Memory efficient - Handles long sessions without memory leaks
- 🔄 Auto-follow - Automatically scroll to new logs
brew tap teaguru/cwlogs
brew install cwlogsDownload the latest release for your platform from GitHub Releases.
Prerequisites:
- Go 1.19 or later
- AWS CLI configured with appropriate permissions
- Access to CloudWatch Logs
- For clipboard support on Linux:
xclip,xsel, orwl-clipboardpackage
git clone https://github.com/teaguru/cwlogs.git
cd cwlogs
make buildInteractive mode (default):
./cwlogsThe application will:
- Show available AWS profiles (if multiple exist)
- Let you select a CloudWatch log group
- Start streaming logs in real-time
Specify AWS profile:
./cwlogs --profile myprofile # Using flag
./cwlogs myprofile # Using positional argument (shorter)Specify AWS region:
./cwlogs --profile dev --region us-west-2 # Using flags
./cwlogs dev us-west-2 # Using positional arguments (shorter)Show help:
./cwlogs --helpCheck version:
./cwlogs --version| Option/Argument | Description | Example |
|---|---|---|
profile |
AWS profile name (positional argument) | cwlogs production |
region |
AWS region (positional argument) | cwlogs production us-west-2 |
--profile <name> |
Use specific AWS profile (flag alternative) | --profile production |
--region <name> |
Use specific AWS region (overrides profile default) | --region us-east-1 |
--version |
Show version information | --version |
--help |
Show help and usage examples | --help |
make build # Build binary
make test # Run tests
make lint # Check code quality
make release # Build release archives for all platforms
make help # Show all targets↑/↓orj/k- Scroll up/down one linePage Up/Page Down- Fast scrollg- Go to topGorEnd- Go to bottom (enables follow mode)
/- Start searchEnter- Execute search (starts at latest/newest match)n- Next match (backward to older logs)N- Previous match (forward to newer logs)Esc- Clear search
J- Toggle between Raw and Formatted modesF- Toggle follow mode (auto-scroll to new logs)H- Load more history
c- Copy current log line to clipboard (original unformatted message)- Mouse/trackpad - Select any text and copy with Cmd+C/Ctrl+C
borBackspace- Go back to log group selectionq- Quit application
When selecting a log group, you can use:
↑/↓orj/k- Navigate through log groups- Type - Start filtering log groups by name (automatic)
Enter- Select log groupR- Change AWS regionEsc- Clear filter (if filtering) or quitq- Quit application
Shows original CloudWatch log messages exactly as received:
[12:34:56] 2023/10/15 12:34:56 [INFO] User login successful
[12:34:57] 2023/10/15 12:34:57 [ERROR] Database connection failed
Parses and colourises structured logs:
[12:34:56] GET /api/users 200 2.3ms - Mozilla/5.0...
[12:34:57] POST /api/login 401 1.1ms - Invalid credentials
- Case-insensitive - Searches ignore case by default
- Regex support - Use regular expressions for complex patterns
- Dual-mode search - Works in both raw and formatted modes
- Highlight preservation - Search highlights remain visible when navigating
- Auto-centring - Found matches automatically centre in viewport
When Follow Mode is enabled (press F):
- New logs automatically appear at the bottom
- Cursor tracks the latest log entry
- Scrolling up automatically disables follow mode
- Press
GorEndto re-enable follow mode
The application supports multiple AWS credential configurations:
Option 1: Simple setup (most common)
# Configure default credentials
aws configure
# Enter your Access Key ID, Secret Access Key, region, and output formatOption 2: Named profiles
# Configure a named profile
aws configure --profile myprofileOption 3: AWS SSO
# Configure SSO profile
aws configure sso --profile mysso
aws sso login --profile myssoOption 4: Environment variables
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
export AWS_DEFAULT_REGION=us-east-1The application will automatically detect available profiles and let you choose, or use the default profile if only one is configured.
Your AWS user/role needs these CloudWatch permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:DescribeLogGroups",
"logs:FilterLogEvents"
],
"Resource": "*"
}
]
}- Use Follow Mode (
F) for real-time monitoring - Search while following - Search automatically disables follow mode
- Toggle formats (
J) to see both raw and parsed views - Load history (
H) to see older logs when needed
Quick access to specific environments:
# Development environment (shorter syntax)
./cwlogs dev
# Production monitoring in specific region
./cwlogs prod us-west-2
# Staging logs in different region
./cwlogs staging eu-west-1
# Alternative flag syntax
./cwlogs --profile production --region us-east-1Automation and scripting:
#!/bin/bash
# Monitor production logs in specific region
echo "Starting production log monitoring..."
./cwlogs production us-west-2Integration with other tools:
# Use with AWS SSO in specific region
aws sso login --profile company-admin
./cwlogs company-admin eu-central-1- Use specific terms to narrow results quickly
- Search works on both timestamp and log content
- Use
n/Nto navigate through multiple matches - Clear search (
Esc) to return to normal browsing
Method 1: Keyboard shortcut
- Press
cto copy the current log line to clipboard - Works on macOS (pbcopy), Linux (xclip/xsel/wl-copy), and Windows (clip)
- Always copies the original unformatted CloudWatch message (even in formatted mode)
- Status message confirms successful copy
Method 2: Mouse/trackpad selection
- Select text with mouse or trackpad (drag to highlight)
- Copy with
Cmd+C(macOS) orCtrl+C(Linux/Windows) - Works with any text in the terminal, including partial lines
- Copies the formatted display text (what you see on screen)
Why use keyboard vs mouse?
- Keyboard (
c): Gets the original CloudWatch message - perfect for debugging, sharing with team, or pasting into other tools - Mouse selection: Gets the formatted display text - useful for copying specific parts or formatted output
- The viewer maintains only the last 5000 logs in memory
- Older logs are automatically removed (no manual cleanup needed)
- Format toggle is instant - switch freely between modes
- Search is cached - repeated searches are fast
"No AWS profiles found"
- Run
aws configureto set up default credentials - Check that
~/.aws/credentialsor~/.aws/configexists - Verify AWS CLI is installed:
aws --version
"No log groups found"
- Check AWS credentials and permissions
- Verify you have access to CloudWatch Logs in the selected region
- Try:
aws logs describe-log-groupsto test access
"AWS SSO session expired"
aws sso login --profile <your-profile>"Failed to load AWS configuration"
- Check your AWS region is set:
aws configure get region - Verify credentials:
aws sts get-caller-identity - For environment variables, ensure all required vars are set
- On EC2: Ensure the instance has an IAM role with CloudWatch permissions attached
"No log groups found" (region-specific)
- Verify you're looking in the correct region:
./cwlogs profile us-west-2 - Check if logs exist in that region:
aws logs describe-log-groups --region us-west-2 - CloudWatch logs are region-specific - try different regions
Logs not updating in real-time
- Check if Follow Mode is enabled (press
F) - Verify CloudWatch is receiving new logs
- Try pressing
Gto jump to latest logs
Search not working
- Try clearing search with
Escand searching again - Check if you're in the right display mode (
Jto toggle) - Verify the search term exists in the visible logs
The application is designed for long-running sessions:
- Memory usage stays constant (typically ~50MB)
- Handles thousands of logs without slowdown
- Automatic cleanup of old logs
- Responsive UI even with high log volume
- Usage Guide - Advanced features and workflows
- AWS Setup - Configure AWS credentials and profiles
- Developer Guide - Architecture and implementation details
- Testing - Test coverage and approach
- Deployment - Building and publishing releases
Apache License 2.0 - See LICENSE file for details.