CLI Reference
Complete reference for the Spotlight CLI (spotlight).
Global Syntax
spotlight [command] [options] [arguments]Commands
run - Run Application with Spotlight
Wraps your application and automatically configures Spotlight.
spotlight run [options] [command...]Examples:
# Auto-detect from package.jsonspotlight run
# Run specific commandspotlight run node server.jsspotlight run python manage.py runserverspotlight run go run main.go
# With custom portspotlight run -p 3000 npm start
# With debug loggingspotlight run -d node server.jsBehavior:
- Starts Spotlight sidecar server
- Sets
SENTRY_SPOTLIGHTenvironment variable - Sets
SENTRY_TRACES_SAMPLE_RATE=1 - Captures stdout/stderr as logs
- Runs the specified command
Auto-detection:
If no command is provided, looks for these scripts in package.json:
devdevelopservestart
tail - Stream Events
Streams events from Spotlight to your terminal in real-time.
spotlight tail [event-types...] [options]Event Types:
errors- Errors and exceptionslogs- Application logstraces- Performance tracesall,everything,*- All event types
Examples:
# Stream all eventsspotlight tail
# Stream only errorsspotlight tail errors
# Stream errors and logsspotlight tail errors logs
# Stream with JSON formatspotlight tail -f json
# Stream traces with logfmt formatspotlight tail traces -f logfmt
# Stream on custom portspotlight tail -p 3000Behavior:
- Connects to existing sidecar or starts new one
- Streams filtered events to stdout
- Formats output based on
-foption
mcp - Start MCP Server
Starts Spotlight in MCP (Model Context Protocol) stdio server mode for integration with AI coding assistants.
spotlight mcp [options]Examples:
# Start MCP server on default portspotlight mcp
# Start on custom portspotlight mcp -p 3000
# Start with debug loggingspotlight mcp -dBehavior:
- Starts Spotlight sidecar server
- Enables MCP protocol over stdio
- Provides tools for AI assistants to query errors, logs, and traces
Available MCP Tools:
spotlight.errors.search- Search for errorsspotlight.logs.search- Search for logsspotlight.traces.search- List tracesspotlight.traces.get- Get trace details
server - Start Standalone Server
Starts the Spotlight sidecar server without any additional modes.
spotlight server [options]spotlight [options] # server is the default commandExamples:
# Start on default port (8969)spotlight server
# Start on custom portspotlight server -p 3000
# Start with debug loggingspotlight server -d
# Shorthand (server is default)spotlightspotlight -p 3000Behavior:
- Starts the sidecar HTTP server
- Listens for events from Sentry SDKs
- Serves the Spotlight UI at
http://localhost:PORT - Streams events via Server-Sent Events (SSE)
help - Show Help
Displays help information.
spotlight helpspotlight --helpspotlight -hGlobal Options
These options work with all commands:
-p, --port <port>
Specify the port for the sidecar server.
- Type: Number (1-65535 or 0)
- Default:
8969(for most commands),0(forruncommand) - Special:
0= auto-assign random available port
Examples:
spotlight -p 3000spotlight --port 9000 tail errorsspotlight run -p 0 npm start # Random port-d, --debug
Enable debug logging for troubleshooting.
- Type: Boolean
- Default:
false
Examples:
spotlight -dspotlight --debug tail logsspotlight run -d node server.jsOutput includes:
- Detailed server startup information
- Connection status
- Event processing details
- SDK communication logs
-h, --help
Show help message and exit.
Examples:
spotlight -hspotlight --help-f, --format <format>
Specify output format for events.
- Type: String
- Options:
human,logfmt,json,md - Default:
human
Examples:
spotlight tail -f jsonspotlight tail --format logfmt errorsspotlight tail errors logs -f mdFormats:
human- Colored, human-readable (default). Based on the hl library.logfmt- Machine-readable key-value pairs following the logfmt format.json- Structured JSON (one per line)md- Markdown format
Environment Variables
SPOTLIGHT_DEBUG
Enable debug logging (alternative to -d flag).
export SPOTLIGHT_DEBUG=1spotlight tailSENTRY_SPOTLIGHT
Set by run command to tell SDKs where to send events.
# Automatically set by spotlight runSENTRY_SPOTLIGHT=http://localhost:8969/streamSENTRY_TRACES_SAMPLE_RATE
Set by run command to enable 100% trace sampling.
# Automatically set by spotlight runSENTRY_TRACES_SAMPLE_RATE=1Exit Codes
0- Success1- General error (invalid arguments, connection failed, etc.)130- Interrupted by user (SIGINT/Ctrl+C)
Configuration Files
Spotlight CLI does not use configuration files. All configuration is done via command-line arguments and environment variables.
Common Patterns
Development Workflow
# Terminal 1: Run your app with Spotlightspotlight run
# Terminal 2: Monitor specific eventsspotlight tail errors logs
# Browser: View in UIopen http://localhost:8969CI/CD Integration
# Capture events during tests as newline-delimited JSON (NDJSON)spotlight tail -f json > events.ndjson &SPOTLIGHT_PID=$!
# Run testsspotlight run npm test
# Cleanupkill $SPOTLIGHT_PIDMulti-Service Setup
# Service 1 (backend)spotlight run -p 8969 npm run dev:backend
# Service 2 (frontend - connects to same sidecar)spotlight run -p 8969 npm run dev:frontendLog Aggregation
# Stream to file with logfmtspotlight tail -f logfmt >> spotlight.log
# Stream to file with JSONspotlight tail -f json | jq . >> spotlight.jsonVersion
To check the installed version:
spotlight --version# or check package versionnpm list -g @spotlightjs/spotlightPackage Information
- Package:
@spotlightjs/sidecar - Binary:
spotlight - Minimum Node Version: 20.0.0
Related Documentation
- Run Command Guide - Detailed guide for running applications
- Tail Command Guide - Detailed guide for streaming events
- MCP Integration - Using Spotlight with AI coding assistants
- Sidecar Documentation - Understanding the sidecar server