Skip to Content
New to Genbox? Check out our Getting Started guide

gb logs

View logs for a genbox (PM2 apps, Docker services).

Synopsis

gb logs [name] [options]

Description

View logs from your genbox applications and infrastructure services. Supports both cloud and local genboxes, with filtering options for PM2 apps, Docker containers, and infrastructure services.

Arguments

ArgumentDescription
nameName of the genbox. Prompts for selection if omitted.

Options

OptionDescription
-f, --followFollow log output in real-time (like tail -f)
-n, --lines <number>Number of lines to show (default: 100)
--service <name>Show logs for specific service/app only
--pm2Show only PM2 app logs
--dockerShow only Docker service logs
--infraShow only infrastructure logs (mongodb, redis, rabbitmq)
--errShow only error logs (PM2 only)

Examples

View All Logs

gb logs my-app
[INFO] === PM2 App Logs === 0|web | Server started on port 3000 0|web | Connected to database 0|api | API listening on port 4000 [INFO] === mongodb Logs === {"t":{"$date":"2025-01-02T10:30:00Z"},"msg":"Connection accepted"} [INFO] === redis Logs === 1:M 02 Jan 2025 10:30:00.123 * Ready to accept connections

Follow Logs in Real-time

gb logs my-app -f
Streaming logs from my-app... (Ctrl+C to stop) ──────────────────────────────────────────────────────────── 0|web | GET /api/users 200 12ms 0|web | GET /api/products 200 8ms [mongodb] connection accepted from 127.0.0.1:54321 0|api | POST /api/orders 201 45ms

View Specific Service

# Application logs gb logs my-app --service web # Infrastructure logs gb logs my-app --service mongodb gb logs my-app --service redis

Filter by Log Type

# Only PM2 application logs gb logs my-app --pm2 # Only Docker container logs gb logs my-app --docker # Only infrastructure (mongo, redis, rabbitmq) gb logs my-app --infra # Only error logs from PM2 gb logs my-app --err

Specify Number of Lines

# Show last 50 lines gb logs my-app -n 50 # Show last 500 lines gb logs my-app -n 500

Combine Options

# Follow web app logs only gb logs my-app -f --service web # Show last 200 lines of error logs gb logs my-app -n 200 --err # Follow infrastructure logs gb logs my-app -f --infra

Log Sources

PM2 Apps

Logs from applications managed by PM2:

  • Web servers (Express, Next.js, etc.)
  • API services
  • Background workers

Docker Services

Logs from containerized infrastructure:

  • MongoDB
  • Redis
  • RabbitMQ
  • PostgreSQL
  • Custom Docker services

Output Format

PM2 logs show:

{process_id}|{app_name} | {log_message}

Docker logs show:

[{container_name}] {log_message}

Local vs Cloud

Works with both local and cloud genboxes:

TypeAccess Method
CloudSSH to remote server
Local (Multipass)SSH to VM
Local (Docker)Docker logs command

Notes

  • Logs are streamed via SSH for remote genboxes
  • Use Ctrl+C to stop following logs
  • Infrastructure logs are limited to 30 lines by default
  • Native isolation mode does not support logs viewing

See Also

Last updated on