Spotlight Tail
The tail command streams events from Spotlight to your terminal in real-time. You can filter by event type and choose different output formats.
Basic Usage
spotlight tail [event-types...] [options]Key features:
- Filter events by type (errors, logs, traces, attachments)
- Choose output format (human, logfmt, json, markdown)
- Connect to existing sidecar or start a new one automatically
Event Types
You can filter which events to display:
Available Event Types
errors- Runtime errors and exceptions with stack traceslogs- Application logs (info, warn, debug messages)traces- Performance traces and spans
Show Everything
Use magic words to show all event types:
spotlight tail# or explicitly:spotlight tail allspotlight tail everythingspotlight tail '*'Filter Specific Types
# Only errorsspotlight tail errors
# Only logsspotlight tail logs
# Errors and logsspotlight tail errors logs
# Errors, logs, and tracesspotlight tail errors logs tracesOutput Formats
Control how events are displayed with the -f or --format option.
Human-Readable Format (Default)
Nicely formatted, colored output optimized for reading:
spotlight tail --format human# or just:spotlight tailExample output:
🔴 ERROR | 2025-10-31 14:23:45TypeError: Cannot read property 'id' of undefined at getUserData (api/users.js:42) at processRequest (api/middleware.js:18)
📝 LOG | 2025-10-31 14:23:46[INFO] Request processed successfully user_id: 12345 duration: 234msLogfmt Format
Machine-readable key-value format:
spotlight tail --format logfmtExample output:
level=error time=2025-10-31T14:23:45Z message="TypeError: Cannot read property" file=api/users.js line=42level=info time=2025-10-31T14:23:46Z message="Request processed" user_id=12345 duration=234msPerfect for:
- Log aggregation tools
- Piping to other CLI tools
- Parsing with standard tools like
grep,awk
JSON Format
Structured JSON output for programmatic processing:
spotlight tail --format jsonExample output:
{"level":"error","timestamp":"2025-10-31T14:23:45Z","message":"TypeError: Cannot read property 'id' of undefined","stack":[...]}{"level":"info","timestamp":"2025-10-31T14:23:46Z","message":"Request processed","user_id":12345,"duration":"234ms"}Perfect for:
- CI/CD pipelines
- Automated testing
- Integration with other tools via
jq
Markdown Format
Formatted for documentation or reports:
spotlight tail --format mdExample output:
## Error - TypeError**Time:** 2025-10-31 14:23:45**File:** api/users.js:42
Cannot read property 'id' of undefined
### Stack Trace- at getUserData (api/users.js:42)- at processRequest (api/middleware.js:18)Perfect for:
- Creating incident reports
- Sharing errors in documentation
- GitHub issues or PRs
Connection Modes
Connect to Existing Sidecar
If a Spotlight sidecar is already running, tail will connect to it:
# Terminal 1: Your app is running with Spotlightnpm run dev
# Terminal 2: Tail eventsspotlight tail errors logsStart New Sidecar
If no sidecar is running, tail will start one automatically:
spotlight tail# ✓ Started new sidecar on port 8969Options
Port Configuration
# Connect to sidecar on default port (8969)spotlight tail
# Connect to custom portspotlight tail -p 3000
# Start sidecar on random available portspotlight tail -p 0Format Selection
# Human-readable (default)spotlight tail -f human
# Logfmt for parsingspotlight tail -f logfmt
# JSON for automationspotlight tail -f json
# Markdown for documentationspotlight tail -f mdDebug Mode
Enable verbose logging to troubleshoot issues:
spotlight tail -d# orspotlight tail --debugCommon Use Cases
Development Monitoring
Monitor errors and logs while developing:
# Terminal 1: Run your appnpm run dev
# Terminal 2: Watch for errors and logsspotlight tail errors logs --format humanCI/CD Integration
Capture events during automated tests:
# Start sidecar and run tests, output as JSONspotlight tail -f json > spotlight-events.json &SIDECAR_PID=$!
# Run your testsnpm test
# Cleanupkill $SIDECAR_PIDError Monitoring
Focus only on errors with clean output:
spotlight tail errors --format logfmt | grep "level=error"Performance Analysis
Stream trace data for performance investigation:
spotlight tail traces --format json | jq '.duration'Log Aggregation
Send formatted logs to a file:
spotlight tail logs --format logfmt >> app-logs.txtAdvanced Examples
Filter and Process with jq
# Get all error messages from the last runspotlight tail errors -f json | jq -r '.message'
# Find slow traces (duration > 1000ms)spotlight tail traces -f json | jq 'select(.duration > 1000)'Combine with grep
# Only show errors from specific filespotlight tail errors -f logfmt | grep "file=api/users.js"
# Watch for specific error messagesspotlight tail errors | grep "database connection"Multiple Filters
# Stream errors and logs, format as logfmt, filter by levelspotlight tail errors logs -f logfmt | grep "level=error"Background Monitoring
# Start tailing in the backgroundspotlight tail -f logfmt > spotlight.log 2>&1 &echo $! > spotlight.pid
# Stop it laterkill $(cat spotlight.pid)Output Examples
Error Output (Human Format)
🔴 ERROR | 2025-10-31 14:23:45.123TypeError: Cannot read property 'id' of undefined
Location: api/users.js:42:10
Stack Trace: at getUserData (api/users.js:42:10) at processRequest (api/middleware.js:18:5) at Layer.handle (express/lib/router/layer.js:95:5)
Context: request_id: req_abc123 user_id: 12345 method: GET path: /api/users/12345Log Output (Logfmt Format)
time=2025-10-31T14:23:45Z level=info message="User login successful" user_id=12345 ip=192.168.1.1time=2025-10-31T14:23:46Z level=warn message="Rate limit approaching" user_id=12345 requests=95 limit=100time=2025-10-31T14:23:47Z level=info message="Database query" query="SELECT * FROM users" duration=15msTrace Output (JSON Format)
{ "trace_id": "71a8c5e41ae1044dee67f50a07538fe7", "span_id": "b1234567890abcde", "transaction": "GET /api/users/:id", "duration": 245.5, "status": "ok", "spans": [ { "description": "database query", "duration": 45.2 }, { "description": "http request", "duration": 120.3 } ]}Troubleshooting
No Events Appearing
- Check SDK Configuration: Ensure your app is sending events to Spotlight
- Verify Connection: Make sure the sidecar is running on the correct port
- Check Event Types: You might be filtering out the events you want to see
# Show all events to see what's coming throughspotlight tail everythingConnection Refused
If you see a connection error:
# Check if sidecar is running on the expected portspotlight tail -p 8969
# Or try starting a new sidecarspotlight tail -p 0 # Use random portEvents Too Verbose
Filter to only what you need:
# Only critical errorsspotlight tail errors -f logfmt | grep "level=error"
# Specific file or componentspotlight tail -f logfmt | grep "file=api/critical.js"