Skip to main content

miren logs

Get logs for an application

Time Range

By default, logs show entries from today. Use --last to specify a different time range:

# Show logs from the last 5 minutes
miren logs --last 5m

# Show logs from the last hour
miren logs --last 1h

# Show logs from the last 24 hours
miren logs --last 24h

Following Logs

Use --follow (or -f) to stream logs in real-time:

# Follow logs as they arrive
miren logs --follow

# Follow logs for a specific app
miren logs --app myapp -f

Filtering by Service

Use --service to filter logs by service name. This is useful for applications with multiple services (e.g., web, worker):

# Show only logs from the web service
miren logs --service web

# Show worker service logs containing "error"
miren logs --service worker -g error

# Follow web service logs
miren logs --service web -f

Filtering Logs

Use the --grep (or -g) flag to filter log output. The filter supports multiple syntax options for flexible searching.

Filter Syntax

SyntaxDescriptionExample
wordMatch logs containing "word" (case-insensitive)error
"phrase"Match logs containing exact phrase"connection failed"
'phrase'Match logs containing exact phrase (alternate)'connection failed'
/regex/Match logs matching regex pattern/err(or)?/
-termExclude logs matching term-debug
term1 term2Match logs containing ALL terms (AND)error timeout

Filter Details

  • Case-insensitive: All word and phrase matches are case-insensitive
  • AND logic: Multiple terms must all match for a log line to be included
  • Negation: Prefix any term with - to exclude matching lines
  • Quotes: Use double (") or single (') quotes for phrases with spaces
  • Regex: Enclose patterns in forward slashes (/pattern/) for regex matching

Log Output Format

Log entries are displayed with the following format:

S 2024-01-15 10:30:45: [source] Log message here
  • Stream prefix: S (stdout), E (stderr), ERR (error), U (user-oob)
  • Timestamp: Date and time when the log was generated
  • Source: Optional source identifier (sandbox ID, truncated if long)
  • Message: The actual log content

Usage

miren logs [flags]

Flags

  • --app, -a — Application get logs for
  • --build, -b — Show build logs for a specific version
  • --cluster, -C — Cluster name
  • --config — Path to the config file
  • --dir, -d — Directory to run from (default: .)
  • --follow, -f — Follow log output (live tail)
  • --grep, -g — Filter logs (e.g., 'error', '"exact phrase"', 'error -debug', '/regex/')
  • --last, -l — Show logs from the last duration
  • --sandbox, -s — Show logs for a specific sandbox ID
  • --service — Filter logs by service name (e.g., 'web', 'worker')

Global Options

  • --options — Path to file containing options
  • --server-address — Server address to connect to (default: 127.0.0.1:8443)
  • --verbose, -v — Enable verbose output

Examples

View logs for the current app:

miren logs

Follow logs in real time:

miren logs -f

Show logs from the last 5 minutes, filtered for errors:

miren logs --last 5m -g error

Filter logs by service:

miren logs --service web -f