Logs

View and manage application logs.

Access application logs and activity history for debugging and auditing.

Log Types

TypeSourcePurpose
PM2 LogsApplicationDebug application issues
Activity LogSupascaleAudit user actions
Container LogsDockerDebug project issues

PM2 Application Logs

Via Web UI

Navigate to Logs to view PM2 application logs.

Via API

curl "https://supascale.example.com/api/v1/system/logs?lines=100" \
  -H "X-API-Key: your-api-key"

Response:

{
  "logs": [
    {
      "timestamp": "2026-01-19T12:00:00Z",
      "type": "out",
      "process": "supascale-web",
      "message": "Server started on port 3000"
    },
    {
      "timestamp": "2026-01-19T12:00:05Z",
      "type": "out",
      "process": "supascale-web",
      "message": "Database connected"
    }
  ],
  "processes": ["supascale-web"]
}

Filter Options

ParameterDescriptionExample
linesNumber of lines100
typeLog typeout, err, all
processProcess namesupascale-web
# Error logs only
curl "https://supascale.example.com/api/v1/system/logs?type=err&lines=50"

# Specific process
curl "https://supascale.example.com/api/v1/system/logs?process=supascale-web"

Activity Log

Track all user and system actions.

Via Web UI

Navigate to Settings > Activity History.

Via API

curl https://supascale.example.com/api/v1/system/activity \
  -H "X-API-Key: your-api-key"

Response:

{
  "activities": [
    {
      "id": "act-123",
      "type": "project",
      "action": "created",
      "target": "my-project",
      "user": "admin",
      "timestamp": "2026-01-19T12:00:00Z",
      "details": {
        "projectName": "My Project"
      }
    },
    {
      "id": "act-124",
      "type": "backup",
      "action": "completed",
      "target": "backup-456",
      "timestamp": "2026-01-19T12:30:00Z",
      "details": {
        "size": 52428800,
        "duration": 120
      }
    }
  ]
}

Activity Types

TypeActions
authlogin, logout, failed_login
projectcreated, started, stopped, deleted
backupcreated, restored, deleted
taskcreated, executed, failed
systemupdated, settings_changed
api_keycreated, deleted

Container Logs

View logs for specific project containers.

Via API

curl "https://supascale.example.com/api/v1/projects/my-project/logs?tail=100" \
  -H "X-API-Key: your-api-key"

Filter by Service

# Database logs
curl "https://supascale.example.com/api/v1/projects/my-project/logs?service=db"

# Auth service logs
curl "https://supascale.example.com/api/v1/projects/my-project/logs?service=auth"

Flush Logs

Clear PM2 logs to free disk space:

Via API

# Flush all logs
curl -X DELETE https://supascale.example.com/api/v1/system/logs \
  -H "X-API-Key: your-api-key"

# Flush specific process
curl -X DELETE "https://supascale.example.com/api/v1/system/logs?process=supascale-web" \
  -H "X-API-Key: your-api-key"

Log Retention

PM2 Log Rotation

Configure PM2 log rotation:

pm2 install pm2-logrotate
pm2 set pm2-logrotate:max_size 10M
pm2 set pm2-logrotate:retain 7

Activity Log

Activity logs are retained in the database. Consider:

  • Archiving old logs periodically
  • Setting up log export for compliance

Searching Logs

Via Command Line

# Search PM2 logs
pm2 logs supascale-web --lines 1000 | grep "error"

# Search with timestamps
pm2 logs supascale-web --timestamp | grep "2026-01-19"

Common Searches

SearchPurpose
errorFind errors
failedFind failures
timeoutFind timeouts
warningFind warnings

Log Analysis

Common Issues

Log PatternPossible Cause
ECONNREFUSEDService not running
ENOSPCDisk full
ENOMEMOut of memory
ETIMEDOUTNetwork/service timeout

Debug Tips

  1. Check timestamps - When did issue start?
  2. Look for patterns - Recurring errors?
  3. Correlate events - What happened before error?
  4. Check resources - Memory/disk issues?

Best Practices

Logging

  1. Set appropriate log levels in production
  2. Rotate logs to prevent disk fill
  3. Monitor log growth trends
  4. Archive important logs for compliance

Auditing

  1. Review activity logs regularly
  2. Track sensitive operations
  3. Export for compliance requirements
  4. Set up alerts for suspicious activity

Troubleshooting

No Logs Appearing

  1. Verify PM2 is running: pm2 status
  2. Check log file permissions
  3. Verify log directory exists
  4. Restart PM2: pm2 restart all

Logs Growing Too Fast

  1. Enable log rotation
  2. Reduce log verbosity
  3. Filter unnecessary logs
  4. Increase rotation frequency