cx-cli
The Coralogix CLI. Query logs, metrics, spans, and Real User Monitoring (RUM) data from the terminal using DataPrime and PromQL—built for humans and AI agents.
What you can do
- Query any signal—logs, metrics, spans, and RUM data—with DataPrime or PromQL, and render results as tables, raw JSON, or a token-efficient format for AI agents.
- List, inspect, and manage dashboards and alerts.
- Run the same query across multiple profiles or regions in a single command.
- Find the right log or span field by describing it in natural language.
- Browse the DataPrime language reference offline.
- Plug Coralogix into your AI coding agent with bundled skills for Claude Code, Cursor, Codex, and 40+ more agents.
Features
- DataPrime and PromQL at the terminal—Coralogix's proprietary query languages work end-to-end without leaving the shell.
- Multi-profile fan-out with
-p prod-eu -p prod-us <command>—run one query across multiple accounts or regions in a single invocation, with rows tagged by profile. agentsoutput format—token-efficient JSON that auto-spills to a temp file once the serialized payload exceeds 100 KiB, so AI agents get a path instead of a flooded context window.- Semantic field search—find the right log or span field by describing it in natural language.
- Bundled skills for Claude Code, Cursor, Codex, OpenCode, and 40+ more agents, distributed via
npx skills add.
Installation
macOS and Linux
Install the latest release with the install script:
Pin a specific version:
CX_VERSION=0.1.0 curl -fsSL https://raw.githubusercontent.com/coralogix/cx-cli/master/install.sh | sh
Homebrew
Cargo
Pre-built binaries
Download the latest release for your platform from GitHub Releases.
Build from source
Quick start
Follow these steps to go from a fresh install to a working query.
Create a profile.
cx profiles addopens an interactive prompt for region, credentials, and default output format:Query logs. The positional argument is a DataPrime query:
Query metrics.
cx metrics querytakes a PromQL expression:Search distributed spans. The positional argument is a DataPrime filter;
source spansis prepended automatically:List dashboards to confirm the API is reachable:
Run cx <command> --help for full syntax and examples on any command.
Commands
| Command | Purpose |
|---|---|
cx profiles | Manage profiles: list, add, delete, set-default |
cx completions | Shell tab-completion: install, refresh, generate |
cx logs | Query logs using DataPrime |
cx spans | Query distributed spans |
cx metrics | Query metrics using PromQL: query, query-range, search, get-labels |
cx dashboards | List and inspect dashboards: catalog, get |
cx alerts | Manage alerts: list, get, create, enable, disable |
cx search-fields | Find log or span fields by description |
cx dataprime | Browse the DataPrime language reference offline, or run raw queries: list, show, query |
cx cleanup | Remove cx_results* temp files older than 30 minutes |
Global options
-p, --profile <PROFILE> Profile to use. Repeat to fan out across multiple profiles.
--api-key <API_KEY> Override the profile API key
--region <REGION> Override the profile region
-o, --output <FORMAT> text | json | agents (default: text)
Configuration
Configuration lives in ~/.cx/:
Credentials are stored in the OS keyring on macOS (Keychain) and Windows (Credential Manager). On Linux, keyring support (Secret Service) requires a glibc build; the default install script and release binaries use musl, which has no keyring backend—credentials fall back to file storage. If you need keyring support on Linux, build from source with a glibc toolchain.
Environment variables override profile settings: CX_PROFILE, CX_API_KEY, and CX_REGION.
See docs/configuration.md for the full reference.
Output formats
Choose an output format with -o or by setting the profile default.
text—human-readable tables with color. Default.json—raw, pretty-printed API responses for scripting.agents—token-efficient format for AI agents. Large responses automatically spill to a temporary file and the path is returned.
See docs/agents-output.md for the agents format specification.
AI agent skills
cx ships a companion skill bundle for Claude Code, Cursor, Codex, OpenCode, and 40+ other agents. The skills teach your agent how to investigate issues by querying Coralogix—without memorizing DataPrime syntax or API endpoints.
Install all skills:
Install selected skills:
Install globally for all projects:
Available skills: query-logs, query-spans, metrics-query, cx-alerts, dataprime, rum, telemetry-querying. See skills/README.md for per-skill usage.
Multi-profile fan-out
Repeat -p to run a command across multiple profiles in parallel. Results are merged and tagged with the profile name:
See docs/multi-profile.md for more examples.
Migrating from cxctl
cx replaces the older Scala-based cxctl. If you are looking for documentation on the legacy tool, see the Coralogix CLI (legacy) docs. cx does not currently cover all legacy surfaces, including LiveTail, SAML management, and account invite flows.
Shell completions
cx supports tab-completion for all commands, flags, subcommands, and profile names.
Managed install (recommended)
Let cx install and track a completion script for you. It writes to a standard user-writable location and records the path so cx completions refresh can update it later:
Default paths used by each shell:
| Shell | Default path |
|---|---|
| zsh | ~/.zfunc/_cx |
| bash | ~/.local/share/bash-completion/completions/cx |
| fish | ~/.config/fish/completions/cx.fish |
After installing for zsh, add ~/.zfunc to your $fpath if it isn't already there (the install command will tell you):
Refreshing after profile changes
When you add or delete a profile, cx will remind you to refresh if you have managed completions. You can run it any time:
Only files previously installed by cx completions install are updated.
Manual install
To generate a script yourself and pipe it anywhere:
cx completions generate zsh > ~/.zfunc/_cx
cx completions generate bash > ~/.local/share/bash-completion/completions/cx
cx completions generate fish > ~/.config/fish/completions/cx.fish
Dynamic completions (always-fresh profile names)
For profile names to update automatically on every Tab press without running refresh, source completions dynamically on each shell start. This calls back into cx at completion time:
zsh — add to ~/.zshrc:
bash — add to ~/.bashrc:
fish — add to ~/.config/fish/config.fish:
Further reading
License
Apache-2.0