> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blaxel.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# bl logs

## bl logs

View and stream logs for agents, jobs, sandboxes, and functions

### Synopsis

View logs for Blaxel resources.

The logs command displays logs for agents, jobs, sandboxes, and functions.
You must specify both the resource type and resource name.

Resource Types (with aliases):

* sandboxes (sandbox, sbx)
* jobs (job, j, jb)
* agents (agent, ag)
* functions (function, fn, mcp, mcps)

Sandbox Process Logs:
For sandboxes, you can view logs for a specific process by adding the process name:
bl logs sandbox my-sandbox my-process

Job Execution Logs:
For jobs, you can filter logs by execution ID and task ID:
bl logs job my-job my-execution-id
bl logs job my-job my-execution-id my-task-id

Time Filtering:
By default, logs from the last 1 hour are displayed.
In follow mode (--follow), the last 15 minutes are shown as context, then new logs
are continuously streamed in real-time.
You can customize this by:

* Using duration format (e.g., 3d, 1h, 10m, 24h) with --period flag
* Using explicit start/end times with --start and --end flags
* Maximum time range is 3 days

Duration units:

* d: days
* h: hours
* m: minutes
* s: seconds

Timestamps:
By default, logs are prefixed with their timestamp in local timezone.
Use --no-timestamps to hide them, or --utc to display timestamps in UTC.

Severity Filtering:
By default, all severity levels are shown. Use --severity to filter by specific levels.
Available severities: FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, UNKNOWN
Use comma-separated values: --severity ERROR,FATAL

Search:
Use --search to filter logs by text content. Only logs containing the search term will be displayed.

Examples:

# View logs for a specific sandbox (last 1 hour - default)

bl logs sandbox my-sandbox

# View logs for a specific process in a sandbox

bl logs sandbox my-sandbox my-process

# Stream process logs in real-time

bl logs sandbox my-sandbox my-process --follow

# View all logs for a job

bl logs job my-job

# View logs for a specific job execution

bl logs job my-job exec-abc123

# View logs for a specific task within an execution

bl logs job my-job exec-abc123 task-456

# Follow job execution logs in real-time

bl logs job my-job exec-abc123 --follow

# Follow logs in real-time (shows last 15 minutes, then streams new logs)

bl logs sandbox my-sandbox --follow

# Follow logs with more historical context

bl logs sandbox my-sandbox --follow --period 1h

# View logs from last 3 days

bl logs job my-job --period 3d

# View logs for a specific time range

bl logs agent my-agent --start 2024-01-01T00:00:00Z --end 2024-01-01T23:59:59Z

# Hide timestamps in output

bl logs agent my-agent --no-timestamps

# Show timestamps in UTC

bl logs agent my-agent --utc

# Filter by severity

bl logs agent my-agent --severity ERROR,FATAL

# Search for specific text in logs

bl logs agent my-agent --search "error"

# Using aliases

bl logs sbx my-sandbox --follow
bl logs j my-job --period 1h
bl logs fn my-function --follow

```
bl logs RESOURCE_TYPE RESOURCE_NAME [NESTED_ARGS...] [flags]
```

### Options

```
      --end string        End time for logs (RFC3339 format or YYYY-MM-DD)
  -f, --follow            Follow log output (like tail -f)
  -h, --help              help for logs
      --no-timestamps     Hide timestamps in log output
  -p, --period string     Time period to fetch logs (e.g., 3d, 1h, 10m, 24h)
      --search string     Search for logs containing specific text
      --severity string   Filter by severity levels (comma-separated): FATAL,ERROR,WARNING,INFO,DEBUG,TRACE,UNKNOWN
      --start string      Start time for logs (RFC3339 format or YYYY-MM-DD)
      --utc               Display timestamps in UTC instead of local timezone
```

### Options inherited from parent commands

```
  -o, --output string          Output format. One of: pretty,yaml,json,table
      --skip-version-warning   Skip version warning
  -v, --verbose                Enable verbose output
  -w, --workspace string       Specify the workspace name
```

### SEE ALSO

* [bl](/cli-reference/commands/bl)	 - Blaxel CLI - manage and deploy AI agents, sandboxes, and resources
