Skip to main content

miren logs app

View application logs

Subcommands

miren logs has subcommands for different log sources:

miren logs app       # Application logs (default)
miren logs sandbox # Sandbox logs
miren logs build # Build logs
miren logs system # System/server logs

Running miren logs without a subcommand shows app logs (backward compatible).

Time Range

By default, logs show the last 100 lines. Use --last to specify a 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 -f

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

Filtering by Service

Use --service to filter logs by service name (app logs only):

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

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

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 app [flags]

Flags

  • --follow, -f — Follow log output (live tail)
  • --format — Output format (text, json) (default: text)
  • --grep, -g — Filter logs (e.g., 'error', '"exact phrase"', 'error -debug', '/regex/')
  • --json — Shorthand for --format json
  • --last, -l — Show logs from the last duration
  • --service — Filter logs by service name (e.g., 'web', 'worker')

Config Options

  • --cluster, -C — Cluster name
  • --config — Path to the config file

App Options

  • --app, -a — Application name
  • --dir, -d — Directory to run from (default: .)

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 app

Follow logs for a specific app:

miren logs app -a myapp -f

Filter logs by service:

miren logs app --service web -f

See also