sentry-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sentry CLI Usage Guide

Sentry CLI使用指南

Help users interact with Sentry from the command line using the
sentry
CLI.
帮助用户使用
sentry
CLI从命令行与Sentry进行交互。

Prerequisites

前提条件

The CLI must be installed and authenticated before use.
使用前必须安装并完成CLI的身份验证。

Installation

安装

bash
curl https://cli.sentry.dev/install -fsS | bash
bash
curl https://cli.sentry.dev/install -fsS | bash

Or install via npm/pnpm/bun

或通过npm/pnpm/bun安装

npm install -g sentry
undefined
npm install -g sentry
undefined

Authentication

身份验证

bash
sentry auth login
sentry auth login --token YOUR_SENTRY_API_TOKEN
sentry auth status
sentry auth logout
bash
sentry auth login
sentry auth login --token YOUR_SENTRY_API_TOKEN
sentry auth status
sentry auth logout

Available Commands

可用命令

Auth

身份验证(Auth)

Authenticate with Sentry
与Sentry进行身份验证

sentry auth login

sentry auth login

Authenticate with Sentry
Flags:
  • --token <value> - Authenticate using an API token instead of OAuth
  • --timeout <value> - Timeout for OAuth flow in seconds (default: 900) - (default: "900")
Examples:
bash
undefined
与Sentry进行身份验证
参数:
  • --token <value> - 使用API token而非OAuth进行身份验证
  • --timeout <value> - OAuth流程超时时间(秒),默认值:900
示例:
bash
undefined

OAuth device flow (recommended)

OAuth设备流(推荐)

sentry auth login
sentry auth login

Using an API token

使用API token

sentry auth login --token YOUR_TOKEN
undefined
sentry auth login --token YOUR_TOKEN
undefined

sentry auth logout

sentry auth logout

Log out of Sentry
Examples:
bash
sentry auth logout
退出Sentry登录
示例:
bash
sentry auth logout

sentry auth refresh

sentry auth refresh

Refresh your authentication token
Flags:
  • --json - Output result as JSON
  • --force - Force refresh even if token is still valid
Examples:
bash
sentry auth refresh
刷新身份验证token
参数:
  • --json - 以JSON格式输出结果
  • --force - 即使token仍有效,强制刷新
示例:
bash
sentry auth refresh

sentry auth status

sentry auth status

View authentication status
Flags:
  • --show-token - Show the stored token (masked by default)
Examples:
bash
sentry auth status
查看身份验证状态
参数:
  • --show-token - 显示已存储的token(默认隐藏部分内容)
示例:
bash
sentry auth status

sentry auth token

sentry auth token

Print the stored authentication token
打印已存储的身份验证token

Org

组织(Org)

Work with Sentry organizations
管理Sentry组织

sentry org list

sentry org list

List organizations
Flags:
  • --limit <value> - Maximum number of organizations to list - (default: "30")
  • --json - Output JSON
Examples:
bash
sentry org list

sentry org list --json
列出组织
参数:
  • --limit <value> - 最多列出的组织数量,默认值:30
  • --json - 以JSON格式输出
示例:
bash
sentry org list

sentry org list --json

sentry org view <org>

sentry org view <org>

View details of an organization
Flags:
  • --json - Output as JSON
  • -w, --web - Open in browser
Examples:
bash
sentry org view <org-slug>

sentry org view my-org

sentry org view my-org -w
查看组织详情
参数:
  • --json - 以JSON格式输出
  • -w, --web - 在浏览器中打开
示例:
bash
sentry org view <org-slug>

sentry org view my-org

sentry org view my-org -w

Project

项目(Project)

Work with Sentry projects
管理Sentry项目

sentry project list <org>

sentry project list <org>

List projects
Flags:
  • -n, --limit <value> - Maximum number of projects to list - (default: "30")
  • --json - Output JSON
  • -p, --platform <value> - Filter by platform (e.g., javascript, python)
Examples:
bash
undefined
列出项目
参数:
  • -n, --limit <value> - 最多列出的项目数量,默认值:30
  • --json - 以JSON格式输出
  • -p, --platform <value> - 按平台过滤(例如javascript、python)
示例:
bash
undefined

List all projects

列出所有项目

sentry project list
sentry project list

List projects in a specific organization

列出指定组织下的项目

sentry project list <org-slug>
sentry project list <org-slug>

Filter by platform

按平台过滤

sentry project list --platform javascript
undefined
sentry project list --platform javascript
undefined

sentry project view <target>

sentry project view <target>

View details of a project
Flags:
  • --json - Output as JSON
  • -w, --web - Open in browser
Examples:
bash
undefined
查看项目详情
参数:
  • --json - 以JSON格式输出
  • -w, --web - 在浏览器中打开
示例:
bash
undefined

Auto-detect from DSN or config

从DSN或配置自动检测

sentry project view
sentry project view

Explicit org and project

明确指定组织和项目

sentry project view <org>/<project>
sentry project view <org>/<project>

Find project across all orgs

在所有组织中查找项目

sentry project view <project>
sentry project view my-org/frontend
sentry project view my-org/frontend -w
undefined
sentry project view <project>
sentry project view my-org/frontend
sentry project view my-org/frontend -w
undefined

Issue

问题(Issue)

Manage Sentry issues
管理Sentry问题

sentry issue list <target>

sentry issue list <target>

List issues in a project
Flags:
  • -q, --query <value> - Search query (Sentry search syntax)
  • -n, --limit <value> - Maximum number of issues to return - (default: "10")
  • -s, --sort <value> - Sort by: date, new, freq, user - (default: "date")
  • --json - Output as JSON
Examples:
bash
undefined
列出项目中的问题
参数:
  • -q, --query <value> - 搜索查询(使用Sentry搜索语法)
  • -n, --limit <value> - 最多返回的问题数量,默认值:10
  • -s, --sort <value> - 排序方式:date(日期)、new(最新)、freq(频率)、user(用户),默认值:date
  • --json - 以JSON格式输出
示例:
bash
undefined

Explicit org and project

明确指定组织和项目

sentry issue list <org>/<project>
sentry issue list <org>/<project>

All projects in an organization

组织下的所有项目

sentry issue list <org>/
sentry issue list <org>/

Search for project across all accessible orgs

在所有可访问组织中查找项目并列出问题

sentry issue list <project>
sentry issue list <project>

Auto-detect from DSN or config

从DSN或配置自动检测

sentry issue list
sentry issue list

List issues in a specific project

列出指定项目中的问题

sentry issue list my-org/frontend
sentry issue list my-org/
sentry issue list frontend
sentry issue list my-org/frontend --query "TypeError"
sentry issue list my-org/frontend --sort freq --limit 20
sentry issue list my-org/frontend
sentry issue list my-org/
sentry issue list frontend
sentry issue list my-org/frontend --query "TypeError"
sentry issue list my-org/frontend --sort freq --limit 20

Show only unresolved issues

仅显示未解决的问题

sentry issue list my-org/frontend --query "is:unresolved"
sentry issue list my-org/frontend --query "is:unresolved"

Show resolved issues

显示已解决的问题

sentry issue list my-org/frontend --query "is:resolved"
sentry issue list my-org/frontend --query "is:resolved"

Combine with other search terms

组合其他搜索条件

sentry issue list my-org/frontend --query "is:unresolved TypeError"
undefined
sentry issue list my-org/frontend --query "is:unresolved TypeError"
undefined

sentry issue explain <issue>

sentry issue explain <issue>

Analyze an issue's root cause using Seer AI
Flags:
  • --json - Output as JSON
  • --force - Force new analysis even if one exists
Examples:
bash
sentry issue explain <issue-id>
使用Seer AI分析问题的根本原因
参数:
  • --json - 以JSON格式输出
  • --force - 即使已有分析结果,强制生成新分析
示例:
bash
sentry issue explain <issue-id>

By numeric issue ID

通过数字问题ID

sentry issue explain 123456789
sentry issue explain 123456789

By short ID with org prefix

通过带组织前缀的短ID

sentry issue explain my-org/MYPROJECT-ABC
sentry issue explain my-org/MYPROJECT-ABC

By project-suffix format

通过项目后缀格式

sentry issue explain myproject-G
sentry issue explain myproject-G

Force a fresh analysis

强制生成全新分析

sentry issue explain 123456789 --force
undefined
sentry issue explain 123456789 --force
undefined

sentry issue plan <issue>

sentry issue plan <issue>

Generate a solution plan using Seer AI
Flags:
  • --cause <value> - Root cause ID to plan (required if multiple causes exist)
  • --json - Output as JSON
  • --force - Force new plan even if one exists
Examples:
bash
sentry issue plan <issue-id>
使用Seer AI生成解决方案计划
参数:
  • --cause <value> - 要生成计划的根本原因ID(当存在多个原因时为必填项)
  • --json - 以JSON格式输出
  • --force - 即使已有计划,强制生成新计划
示例:
bash
sentry issue plan <issue-id>

After running explain, create a plan

运行explain后创建计划

sentry issue plan 123456789
sentry issue plan 123456789

Specify which root cause to plan for (if multiple were found)

指定针对哪个根本原因生成计划(当找到多个原因时)

sentry issue plan 123456789 --cause 0
sentry issue plan 123456789 --cause 0

By short ID with org prefix

通过带组织前缀的短ID

sentry issue plan my-org/MYPROJECT-ABC --cause 1
sentry issue plan my-org/MYPROJECT-ABC --cause 1

By project-suffix format

通过项目后缀格式

sentry issue plan myproject-G --cause 0
undefined
sentry issue plan myproject-G --cause 0
undefined

sentry issue view <issue>

sentry issue view <issue>

View details of a specific issue
Flags:
  • --json - Output as JSON
  • -w, --web - Open in browser
  • --spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")
Examples:
bash
undefined
查看特定问题的详情
参数:
  • --json - 以JSON格式输出
  • -w, --web - 在浏览器中打开
  • --spans <value> - Span树深度限制(数字,"all"表示无限制,"no"表示禁用),默认值:3
示例:
bash
undefined

By issue ID

通过问题ID

sentry issue view <issue-id>
sentry issue view <issue-id>

By short ID

通过短ID

sentry issue view <short-id>
sentry issue view FRONT-ABC
sentry issue view FRONT-ABC -w
undefined
sentry issue view <short-id>
sentry issue view FRONT-ABC
sentry issue view FRONT-ABC -w
undefined

Event

事件(Event)

View Sentry events
查看Sentry事件

sentry event view <args...>

sentry event view <args...>

View details of a specific event
Flags:
  • --json - Output as JSON
  • -w, --web - Open in browser
  • --spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")
Examples:
bash
sentry event view <event-id>

sentry event view abc123def456

sentry event view abc123def456 -w
查看特定事件的详情
参数:
  • --json - 以JSON格式输出
  • -w, --web - 在浏览器中打开
  • --spans <value> - Span树深度限制(数字,"all"表示无限制,"no"表示禁用),默认值:3
示例:
bash
sentry event view <event-id>

sentry event view abc123def456

sentry event view abc123def456 -w

Api

API

Make an authenticated API request
发起已认证的API请求

sentry api <endpoint>

sentry api <endpoint>

Make an authenticated API request
Flags:
  • -X, --method <value> - The HTTP method for the request - (default: "GET")
  • -F, --field <value>... - Add a typed parameter (key=value, key[sub]=value, key[]=value)
  • -f, --raw-field <value>... - Add a string parameter without JSON parsing
  • -H, --header <value>... - Add a HTTP request header in key:value format
  • --input <value> - The file to use as body for the HTTP request (use "-" to read from standard input)
  • -i, --include - Include HTTP response status line and headers in the output
  • --silent - Do not print the response body
  • --verbose - Include full HTTP request and response in the output
Examples:
bash
sentry api <endpoint> [options]
发起已认证的API请求
参数:
  • -X, --method <value> - HTTP请求方法,默认值:GET
  • -F, --field <value>... - 添加类型化参数(格式为key=value、key[sub]=value、key[]=value)
  • -f, --raw-field <value>... - 添加字符串参数,不进行JSON解析
  • -H, --header <value>... - 添加HTTP请求头,格式为key:value
  • --input <value> - 作为HTTP请求体的文件(使用"-"表示从标准输入读取)
  • -i, --include - 在输出中包含HTTP响应状态行和头信息
  • --silent - 不打印响应体
  • --verbose - 在输出中包含完整的HTTP请求和响应
示例:
bash
sentry api <endpoint> [options]

List organizations

列出组织

sentry api /organizations/
sentry api /organizations/

Get a specific organization

获取特定组织信息

sentry api /organizations/my-org/
sentry api /organizations/my-org/

Get project details

获取项目详情

sentry api /projects/my-org/my-project/
sentry api /projects/my-org/my-project/

Create a new project

创建新项目

sentry api /teams/my-org/my-team/projects/
--method POST
--field name="New Project"
--field platform=javascript
sentry api /teams/my-org/my-team/projects/
--method POST
--field name="New Project"
--field platform=javascript

Update an issue status

更新问题状态

sentry api /issues/123456789/
--method PUT
--field status=resolved
sentry api /issues/123456789/
--method PUT
--field status=resolved

Assign an issue

分配问题

sentry api /issues/123456789/
--method PUT
--field assignedTo="user@example.com"
sentry api /issues/123456789/
--method PUT
--field assignedTo="user@example.com"

Delete a project

删除项目

sentry api /projects/my-org/my-project/
--method DELETE
sentry api /organizations/
--header "X-Custom-Header:value"
sentry api /organizations/ --include
sentry api /projects/my-org/my-project/
--method DELETE
sentry api /organizations/
--header "X-Custom-Header:value"
sentry api /organizations/ --include

Get all issues (automatically follows pagination)

获取所有问题(自动处理分页)

sentry api /projects/my-org/my-project/issues/ --paginate
undefined
sentry api /projects/my-org/my-project/issues/ --paginate
undefined

Cli

CLI相关(Cli)

CLI-related commands
与CLI本身相关的命令

sentry cli feedback <message...>

sentry cli feedback <message...>

Send feedback about the CLI
发送关于CLI的反馈

sentry cli fix

sentry cli fix

Diagnose and repair CLI database issues
Flags:
  • --dry-run - Show what would be fixed without making changes
诊断并修复CLI数据库问题
参数:
  • --dry-run - 显示将修复的内容但不实际修改

sentry cli setup

sentry cli setup

Configure shell integration
Flags:
  • --install - Install the binary from a temp location to the system path
  • --method <value> - Installation method (curl, npm, pnpm, bun, yarn)
  • --no-modify-path - Skip PATH modification
  • --no-completions - Skip shell completion installation
  • --no-agent-skills - Skip agent skill installation for AI coding assistants
  • --quiet - Suppress output (for scripted usage)
配置Shell集成
参数:
  • --install - 将二进制文件从临时位置安装到系统路径
  • --method <value> - 安装方式(curl、npm、pnpm、bun、yarn)
  • --no-modify-path - 跳过PATH修改
  • --no-completions - 跳过Shell补全安装
  • --no-agent-skills - 跳过AI编码助手的Agent技能安装
  • --quiet - 抑制输出(适用于脚本场景)

sentry cli upgrade <version>

sentry cli upgrade <version>

Update the Sentry CLI to the latest version
Flags:
  • --check - Check for updates without installing
  • --method <value> - Installation method to use (curl, npm, pnpm, bun, yarn)
将Sentry CLI更新到最新版本
参数:
  • --check - 检查更新但不安装
  • --method <value> - 使用的安装方式(curl、npm、pnpm、bun、yarn)

Repo

仓库(Repo)

Work with Sentry repositories
管理Sentry仓库

sentry repo list <org>

sentry repo list <org>

List repositories
Flags:
  • -n, --limit <value> - Maximum number of repositories to list - (default: "30")
  • --json - Output JSON
列出仓库
参数:
  • -n, --limit <value> - 最多列出的仓库数量,默认值:30
  • --json - 以JSON格式输出

Log

日志(Log)

View Sentry logs
查看Sentry日志

sentry log list <target>

sentry log list <target>

List logs from a project
Flags:
  • -n, --limit <value> - Number of log entries (1-1000) - (default: "100")
  • -q, --query <value> - Filter query (Sentry search syntax)
  • -f, --follow <value> - Stream logs (optionally specify poll interval in seconds)
  • --json - Output as JSON
Examples:
bash
undefined
列出项目中的日志
参数:
  • -n, --limit <value> - 日志条目数量(1-1000),默认值:100
  • -q, --query <value> - 过滤查询(使用Sentry搜索语法)
  • -f, --follow <value> - 流式输出日志(可指定轮询间隔秒数)
  • --json - 以JSON格式输出
示例:
bash
undefined

Auto-detect from DSN or config

从DSN或配置自动检测

sentry log list
sentry log list

Explicit org and project

明确指定组织和项目

sentry log list <org>/<project>
sentry log list <org>/<project>

Search for project across all accessible orgs

在所有可访问组织中查找项目并列出日志

sentry log list <project>
sentry log list <project>

List last 100 logs (default)

列出最近100条日志(默认)

sentry log list
sentry log list

Stream with default 2-second poll interval

以默认2秒轮询间隔流式输出

sentry log list -f
sentry log list -f

Stream with custom 5-second poll interval

以自定义5秒轮询间隔流式输出

sentry log list -f 5
sentry log list -f 5

Show only error logs

仅显示错误日志

sentry log list -q 'level:error'
sentry log list -q 'level:error'

Filter by message content

按消息内容过滤

sentry log list -q 'database'
sentry log list -q 'database'

Show last 50 logs

列出最近50条日志

sentry log list --limit 50
sentry log list --limit 50

Show last 500 logs

列出最近500条日志

sentry log list -n 500
sentry log list -n 500

Stream error logs from a specific project

流式输出指定项目的错误日志

sentry log list my-org/backend -f -q 'level:error'
undefined
sentry log list my-org/backend -f -q 'level:error'
undefined

sentry log view <args...>

sentry log view <args...>

View details of a specific log entry
Flags:
  • --json - Output as JSON
  • -w, --web - Open in browser
Examples:
bash
undefined
查看特定日志条目的详情
参数:
  • --json - 以JSON格式输出
  • -w, --web - 在浏览器中打开
示例:
bash
undefined

Auto-detect from DSN or config

从DSN或配置自动检测

sentry log view <log-id>
sentry log view <log-id>

Explicit org and project

明确指定组织和项目

sentry log view <org>/<project> <log-id>
sentry log view <org>/<project> <log-id>

Search for project across all accessible orgs

在所有可访问组织中查找项目并查看日志

sentry log view <project> <log-id>
sentry log view 968c763c740cfda8b6728f27fb9e9b01
sentry log view 968c763c740cfda8b6728f27fb9e9b01 -w
sentry log view my-org/backend 968c763c740cfda8b6728f27fb9e9b01
sentry log list --json | jq '.[] | select(.level == "error")'
undefined
sentry log view <project> <log-id>
sentry log view 968c763c740cfda8b6728f27fb9e9b01
sentry log view 968c763c740cfda8b6728f27fb9e9b01 -w
sentry log view my-org/backend 968c763c740cfda8b6728f27fb9e9b01
sentry log list --json | jq '.[] | select(.level == "error")'
undefined

Trace

追踪(Trace)

View distributed traces
查看分布式追踪

sentry trace list <target>

sentry trace list <target>

List recent traces in a project
Flags:
  • -n, --limit <value> - Number of traces (1-1000) - (default: "20")
  • -q, --query <value> - Search query (Sentry search syntax)
  • -s, --sort <value> - Sort by: date, duration - (default: "date")
  • --json - Output as JSON
列出项目中的近期追踪数据
参数:
  • -n, --limit <value> - 追踪数据数量(1-1000),默认值:20
  • -q, --query <value> - 搜索查询(使用Sentry搜索语法)
  • -s, --sort <value> - 排序方式:date(日期)、duration(时长),默认值:date
  • --json - 以JSON格式输出

sentry trace view <args...>

sentry trace view <args...>

View details of a specific trace
Flags:
  • --json - Output as JSON
  • -w, --web - Open in browser
  • --spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")
查看特定追踪数据的详情
参数:
  • --json - 以JSON格式输出
  • -w, --web - 在浏览器中打开
  • --spans <value> - Span树深度限制(数字,"all"表示无限制,"no"表示禁用),默认值:3

Issues

问题列表(Issues)

List issues in a project
列出项目中的问题

sentry issues <target>

sentry issues <target>

List issues in a project
Flags:
  • -q, --query <value> - Search query (Sentry search syntax)
  • -n, --limit <value> - Maximum number of issues to return - (default: "10")
  • -s, --sort <value> - Sort by: date, new, freq, user - (default: "date")
  • --json - Output as JSON
列出项目中的问题
参数:
  • -q, --query <value> - 搜索查询(使用Sentry搜索语法)
  • -n, --limit <value> - 最多返回的问题数量,默认值:10
  • -s, --sort <value> - 排序方式:date(日期)、new(最新)、freq(频率)、user(用户),默认值:date
  • --json - 以JSON格式输出

Orgs

组织列表(Orgs)

List organizations
列出组织

sentry orgs

sentry orgs

List organizations
Flags:
  • --limit <value> - Maximum number of organizations to list - (default: "30")
  • --json - Output JSON
列出组织
参数:
  • --limit <value> - 最多列出的组织数量,默认值:30
  • --json - 以JSON格式输出

Projects

项目列表(Projects)

List projects
列出项目

sentry projects <org>

sentry projects <org>

List projects
Flags:
  • -n, --limit <value> - Maximum number of projects to list - (default: "30")
  • --json - Output JSON
  • -p, --platform <value> - Filter by platform (e.g., javascript, python)
列出项目
参数:
  • -n, --limit <value> - 最多列出的项目数量,默认值:30
  • --json - 以JSON格式输出
  • -p, --platform <value> - 按平台过滤(例如javascript、python)

Repos

仓库列表(Repos)

List repositories
列出仓库

sentry repos <org>

sentry repos <org>

List repositories
Flags:
  • -n, --limit <value> - Maximum number of repositories to list - (default: "30")
  • --json - Output JSON
列出仓库
参数:
  • -n, --limit <value> - 最多列出的仓库数量,默认值:30
  • --json - 以JSON格式输出

Logs

日志列表(Logs)

List logs from a project
列出项目中的日志

sentry logs <target>

sentry logs <target>

List logs from a project
Flags:
  • -n, --limit <value> - Number of log entries (1-1000) - (default: "100")
  • -q, --query <value> - Filter query (Sentry search syntax)
  • -f, --follow <value> - Stream logs (optionally specify poll interval in seconds)
  • --json - Output as JSON
列出项目中的日志
参数:
  • -n, --limit <value> - 日志条目数量(1-1000),默认值:100
  • -q, --query <value> - 过滤查询(使用Sentry搜索语法)
  • -f, --follow <value> - 流式输出日志(可指定轮询间隔秒数)
  • --json - 以JSON格式输出

Traces

追踪列表(Traces)

List recent traces in a project
列出项目中的近期追踪数据

sentry traces <target>

sentry traces <target>

List recent traces in a project
Flags:
  • -n, --limit <value> - Number of traces (1-1000) - (default: "20")
  • -q, --query <value> - Search query (Sentry search syntax)
  • -s, --sort <value> - Sort by: date, duration - (default: "date")
  • --json - Output as JSON
列出项目中的近期追踪数据
参数:
  • -n, --limit <value> - 追踪数据数量(1-1000),默认值:20
  • -q, --query <value> - 搜索查询(使用Sentry搜索语法)
  • -s, --sort <value> - 排序方式:date(日期)、duration(时长),默认值:date
  • --json - 以JSON格式输出

Output Formats

输出格式

JSON Output

JSON输出

Most list and view commands support
--json
flag for JSON output, making it easy to integrate with other tools:
bash
sentry org list --json | jq '.[] | .slug'
大多数列表和查看命令支持
--json
参数以JSON格式输出,便于与其他工具集成:
bash
sentry org list --json | jq '.[] | .slug'

Opening in Browser

在浏览器中打开

View commands support
-w
or
--web
flag to open the resource in your browser:
bash
sentry issue view PROJ-123 -w
查看命令支持
-w
--web
参数,在浏览器中打开对应资源:
bash
sentry issue view PROJ-123 -w