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
| Argument | Description |
|---|---|
name | Name of the genbox. Prompts for selection if omitted. |
Options
| Option | Description |
|---|---|
-f, --follow | Follow 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 |
--pm2 | Show only PM2 app logs |
--docker | Show only Docker service logs |
--infra | Show only infrastructure logs (mongodb, redis, rabbitmq) |
--err | Show 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 connectionsFollow Logs in Real-time
gb logs my-app -fStreaming 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 45msView Specific Service
# Application logs
gb logs my-app --service web
# Infrastructure logs
gb logs my-app --service mongodb
gb logs my-app --service redisFilter 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 --errSpecify Number of Lines
# Show last 50 lines
gb logs my-app -n 50
# Show last 500 lines
gb logs my-app -n 500Combine 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 --infraLog 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:
| Type | Access Method |
|---|---|
| Cloud | SSH 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
gb status- Check genbox statusgb connect- SSH into genboxgb ps- Show running local genboxes
Last updated on