Coralogix CLI
$ cx 官方出品 中风险Coralogix CLI(cx)支持使用 DataPrime 与 PromQL 查询日志、链路与指标(cx logs、cx spans、cx metrics、cx dataprime),管理告警与 SLO,并提供 cx schema 供 Agent 自发现命令。原生支持 -o json、紧凑 -o toon 输出及 --url、--label 作用域控制。
brew install cx cx 内置 cx schema 命令树自省与面向 LLM 优化的 -o toon 紧凑序列化格式,查询遥测日志时比冗长的 JSON MCP 载荷更省 Token。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
专为编码 Agent 打造,具备 -o json、省 Token 的 -o toon、cx schema JSON 自省以及 --url、--label 非交互标志。
- Supports
-o jsonand LLM-optimized-o toonoutput formats - Exposes
cx schemato dump the full command tree programmatically
基于作用域 API 密钥与区域 --url / --label 参数防止跨环境误操作,但告警与 SLO 变更缺少 --dry-run。
- Explicit
--urland--labelflags scope target regions - Supports separate
alerts enable/alerts disabletoggles
可通过 Homebrew(brew install cx)及跨平台发布二进制直接安装。
- Single-binary install via
brew install cx
单工具统一覆盖 DataPrime 日志、链路、PromQL 指标、告警与 SLO 检查,上下文开销极低。
- Cross-pillar telemetry querying (
logs,spans,metrics,alerts,slos)
Coralogix 官方仓库(coralogix/cx-cli),Apache-2.0 开源协议。
- First-party
coralogix/cx-clirepository
提供 cx schema 运行时自省、官方 Agent Skill 指引与完整的 Coralogix CLI 文档。
- Official docs and
cx schemaself-describing command tree
安全边界、鉴权与放权指南
将区域配置文件保存在 ~/.cx/,或读取 CORALOGIX_API_KEY 环境变量及 --url / --label 覆盖参数。
Apache-2.0 开源 CLI 免费;需配合 Coralogix 账号及对应权限的 API 密钥使用。
# Coralogix CLI (cx) Agent Rules - Always include `| limit <N>` in DataPrime queries and use `-o toon` or `-o json`. - Run `cx schema` to verify exact command arguments before mutating `cx alerts` or `cx slos`. - Pass `--label` / `--url` or `CORALOGIX_API_KEY` explicitly to target the right Coralogix region.
Agent 高频安全命令配方
只读查询(安全推荐)
cx dataprime query "source logs | filter \$l.applicationname == 'api' | limit 20" -o toon
执行带行数限制的 DataPrime 日志查询,并输出专为 Agent 优化的 -o toon 紧凑格式。
cx alerts list -o json
在不改动远端配置的前提下获取结构化 JSON 格式的 Coralogix 告警定义。
受控写入与预演
cx alerts disable <alert-id> -o json
暂停噪音告警规则并返回更新后的 JSON 状态。
核心优势
- + 原生
-o toon格式在读取大批量日志和链路数据时显著降低上下文 Token 消耗。 - +
cx schema为 Agent 提供全量子命令与参数的机器可读发现能力。
注意事项与踩坑点
- ! 未加
limit限制的 DataPrime 查询仍可能返回较大载荷。 - !
cx alerts create、cx alerts delete和cx slos等写操作缺少通用--dry-run。