Skip to content

Getting Started

github-actions[bot] edited this page Nov 13, 2026 · 3 revisions

Getting Started

Install the tool, point it at a stack, and confirm it can read rules.

Install

From crates.io, with the stable Rust toolchain:

cargo install elasticctl

Or use a prebuilt binary. Each release ships archives for Linux (glibc and musl, x86_64 and aarch64), macOS (Intel and Apple Silicon), and Windows x86_64. The installer scripts download the right archive and put the binaries on PATH:

# macOS and Linux
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/dannyota/elasticctl/releases/latest/download/elasticctl-installer.sh \
  | sh
# Windows
powershell -ExecutionPolicy Bypass -c "irm https://github.com/dannyota/elasticctl/releases/latest/download/elasticctl-installer.ps1 | iex"

Every method installs two names for one binary: elasticctl and the shorter elkctl. elkctl --version prints elasticctl <version>.

Create an API key

Create an Elasticsearch API key inside Kibana: Project Settings, Management, API keys on Serverless, or Stack Management, API keys on Hosted and self-managed, scoped to the project or deployment. An organization-level Elastic Cloud key is not supported. See which key to use.

Create a profile

A profile stores one stack's URL, credential, and space. Create one from environment variables:

export ELASTICCTL_KIBANA_URL=https://YOUR-PROJECT.kb.YOUR-REGION.aws.elastic.cloud
export ELASTICCTL_API_KEY=...
elkctl config init --from-env

On Elastic Cloud, also set ELASTICCTL_ES_URL to the Elasticsearch endpoint. Search and the MCP query tools need it. On a self-managed stack the Kibana host serves both and the variable stays unset.

Name the profile with --name, and select it later with --profile:

elkctl config init --from-env --name prod
elkctl --profile prod info

Check the connection

elkctl doctor

doctor checks configuration, connectivity, the deployment flavor, authentication, the key's scope, and rule access. Fix what it reports before going further. It still runs when the configuration is broken and reports that as a failed config check. A warn check does not fail the report. elkctl info shows the stack version, flavor, license tier, and spaces.

First commands

elkctl rules list --source custom
elkctl rules get <rule_id-or-name>
elkctl alerts list --status open --since 24h

Reads print a table. Add --json for JSON.

Changes are previews until you pass --yes:

elkctl rules disable <rule_id>         # prints what would change
elkctl rules disable <rule_id> --yes   # applies it

Both lines name the profile, host, and space they target.

Next steps

  • Keep rules in Git: Rules as Code.
  • Learn the output and error contract for scripts: CLI.
  • Connect an MCP client: MCP.

Clone this wiki locally