๐ฆ gcp-racoon
GCP Log Spy with Gemini AI
A powerful terminal UI for streaming, querying, and analyzing Google Cloud Platform logs with Gemini powered insights.
โจ Features
- ๐ด Real-time Log Streaming - Watch logs as they happen with a beautiful TUI
- ๐ Powerful Querying - Use GCP filter syntax or natural language
- ๐ค AI-Powered Analysis - Explain errors, generate queries, answer questions about your logs
- ๐ Offline Mode - Export logs and analyze them later without internet
- ๐จ Themeable - Dark and light themes for comfortable viewing
- โจ๏ธ Vim-style Navigation - Efficient keyboard-driven interface
- ๐ Secure - Uses your existing GCP credentials
๐ฆ Installation
From Binary (Recommended)
Download the latest release for your platform:
# macOS (Apple Silicon)
|
# macOS (Intel)
|
# Linux (x86_64)
|
# Windows (PowerShell)
From Source
# Clone the repository
# Build and install
Using Cargo
Using Docker
# Pull the image
# Run directly
# Create an alias for convenience
# Now use like a normal command
Using Homebrew (macOS/Linux)
# Coming soon
# brew tap staninbui/tap
# brew install gcp-racoon
๐ Quick Start
1. Authenticate with GCP
Racoon uses your existing GCP credentials. Make sure you're authenticated:
# Using gcloud
# Or set service account key
2. Set up AI (Optional)
For AI features, set your Gemini API key:
Or add to config file (~/.config/racoon/config.toml):
[]
= "your-api-key-here"
3. Start Using Racoon
# Stream logs in real-time
# Query logs
# List projects
# Check authentication
๐ Usage
Commands
| Command | Description |
|---|---|
tail |
Stream logs in real-time with TUI |
query |
Execute a one-off log query |
projects |
List accessible GCP projects |
auth |
Verify authentication status |
export |
Export logs to a file |
download |
Quick download logs |
view |
View logs from a local file (offline) |
config |
Manage configuration |
Tail Mode (TUI)
Keyboard Shortcuts
| Key | Action |
|---|---|
j / โ |
Move down |
k / โ |
Move up |
g / Home |
Go to first log |
G / End |
Go to last log |
PageDown |
Skip 10 logs down |
PageUp |
Skip 10 logs up |
/ |
Search within logs |
n |
Next search match |
N |
Previous search match |
f |
Set GCP filter |
e |
Explain selected log with AI |
? |
Ask AI a question |
p |
Pause/resume streaming |
t |
Toggle theme (dark/light) |
Ctrl+j/k |
Scroll detail pane |
Ctrl+n/p |
Scroll AI pane |
Esc |
Clear search/AI/filter |
q |
Quit |
Query Mode
# Basic query
# With filter
# With AI-generated filter
Export & Offline Mode
# Export logs to JSON
# Export with AI query
# Export to NDJSON (newline-delimited)
# View exported logs offline
Configuration
# Show config file path
# Create default config
# Show current config
# Edit config
โ๏ธ Configuration
Config file location: ~/.config/racoon/config.toml
# AI Settings
[]
= "your-gemini-api-key"
= "gemini-2.0-flash"
# Default Values
[]
= "my-default-project"
= "1h"
= 100
= "INFO"
# UI Settings
[]
= 100
= false
= "dark" # or "light"
# Logging
[]
= "info"
Environment Variables
| Variable | Description |
|---|---|
GEMINI_API_KEY |
Gemini API key (overrides config) |
GOOGLE_APPLICATION_CREDENTIALS |
Path to GCP service account key |
๐ค AI Features
Racoon integrates with Google Gemini for intelligent log analysis.
Explain Logs
Press e on any log to get an AI explanation:
โโ AI Analysis โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ### 1. Summary โ
โ This error indicates a connection timeout to the โ
โ database server. The request waited 30 seconds but โ
โ no response was received. โ
โ โ
โ ### 2. Severity Assessment โ
โ **High** - Database connectivity issues can cause โ
โ cascading failures across dependent services. โ
โ โ
โ ### 3. Recommended Actions โ
โ 1. Check database server health โ
โ 2. Verify network connectivity โ
โ 3. Review connection pool settings โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Ask Questions
Press ? and ask in natural language:
? Are there any errors from Cloud Run in the last hour?
โโ AI Analysis โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Yes, I found 3 errors from Cloud Run: โ
โ โ
โ 1. 10:23:15 - Container failed to start (OOM) โ
โ 2. 10:25:33 - Request timeout after 300s โ
โ 3. 10:45:01 - Connection refused to backend โ
โ โ
โ The most critical is the OOM error which suggests โ
โ your container needs more memory allocation. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
AI Commands
You can also use AI to set filters:
? ๅธฎๆ่ฎพ็ฝฎ่ฟๆปคๆกไปถไธบไป
ๆพ็คบERRORไปฅไธ็ๆฅๅฟ
โ
ๅทฒ่ฎพ็ฝฎ่ฟๆปคๆกไปถ: severity>=ERROR
๐ Supported GCP Log Types
- Cloud Run
- Cloud Functions
- App Engine
- Kubernetes Engine (GKE)
- Compute Engine
- Cloud SQL
- BigQuery
- Custom logs (any
logName)
๐ง Troubleshooting
Authentication Issues
# Re-authenticate
# Check current credentials
No Logs Showing
- Check project ID is correct
- Verify you have
roles/logging.viewerpermission - Try a broader time range:
--since 24h
AI Not Working
- Check API key is set:
racoon config show - Verify API key at Google AI Studio
- Check network connectivity
๐ License
MIT License - see LICENSE for details.
๐ Acknowledgments
- ratatui - Terminal UI framework
- Google Cloud Logging - Log infrastructure
- Google Gemini - AI capabilities
Made with โค๏ธ and ๐ฆ