# cx-cost-optimization

Guides your agent through diagnosing Coralogix spend spikes, tuning TCO policies, and moving cold telemetry to archive storage.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3300 installs · ★ 124
- Author: coralogix
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/coralogix/cx-cli/tree/HEAD/skills/cx-cost-optimization/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/cx-cost-optimization

## What it does

This skill provides standard operating procedures for the Coralogix `cx` CLI to investigate and trim observability expenses. It handles the entire lifecycle: inspecting billable units, identifying heavy log streams, adjusting retention periods, and configuring cold archive targets.

Accurate consumption checks enforce a strict two-step routine. The agent must run `cx usage capabilities` before issuing `cx usage query`. Guessing labels, units, or limits fails immediately because allowed query parameters are tenant-specific.

Policy updates avoid inline guesswork. Commands like `cx tco create`, `cx retentions update`, and `cx archive logs set` require input passed via `--from-file` or standard input.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add coralogix/cx-cli --skill cx-cost-optimization -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/cx-cost-optimization/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/cx-cost-optimization/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add coralogix/cx-cli --skill cx-cost-optimization -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/cx-cost-optimization/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add coralogix/cx-cli --skill cx-cost-optimization -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/cx-cost-optimization/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install coralogix/cx-cli cx-cost-optimization
```

2. **Manually: put the files in place**
- File: `.github/skills/cx-cost-optimization/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add coralogix/cx-cli --skill cx-cost-optimization -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/coralogix/cx-cli --path skills/cx-cost-optimization
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/cx-cost-optimization/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add coralogix/cx-cli --skill cx-cost-optimization -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/coralogix/cx-cli/tree/HEAD/skills/cx-cost-optimization/SKILL.md

## When to use it
- identify top log and span volume drivers in Coralogix
- shift low-priority logs from Frequent Search to cheap archive storage
- shorten unnecessarily long retention windows across indices
- verify and configure cold archive destinations for logs and metrics

## Example prompts
- Check our Coralogix data consumption and explain why the bill increased
- Review our TCO policies to find low-priority logs stored in Frequent Search
- Help me configure cold archive storage using cx archive logs

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: e1755ca7acc7cd05.

BEGIN THIRD-PARTY FILE e1755ca7acc7cd05
```text
---
name: cx-cost-optimization
description: >
  Use this skill when the user asks to "check data usage", "list TCO policies",
  "reduce Coralogix costs", "optimize observability spend", "lower our logging bill",
  "data budget exceeded", "TCO policy", "retention tier", "archive storage", "ingestion costs",
  "frequent search vs archive", "why is our bill so high", "spending too much on logs",
  "data retention settings", "cost analysis", "usage breakdown",
  "optimize log volume", "control data ingestion", "archive cold data",
  "billing units", "plan consumption", "daily plan", "overage", "PAYG",
  "usage anomaly", "usage trend", "cx_data_usage_units",
  or wants to investigate, analyze, or reduce Coralogix data costs.
metadata:
  version: "0.1.0"
---

# Cost Optimization Skill

Use this skill when investigating or reducing Coralogix data costs. It covers the full cost management lifecycle: measuring current spend, reviewing TCO policies, adjusting retention periods, and configuring archive storage for cold data.

---

## CLI Commands

| Command | Subcommands | Purpose |
|---|---|---|
| `cx usage` | `summary`, `daily`, `logs-count`, `spans-count`, `export-status`, `capabilities`, `query` | Measure current data consumption and billable usage |
| `cx tco` | `list`, `get`, `create`, `update`, `delete`, `reorder`, `test`, `settings`, `settings-update` | Manage TCO (Total Cost of Ownership) policies |
| `cx retentions` | `list`, `update`, `activate`, `status` | Manage data retention periods |
| `cx archive logs` | `get`, `set` | Configure logs archive target |
| `cx archive metrics` | `get`, `create`, `update`, `enable`, `disable`, `validate` | Configure metrics archive storage |
| `cx metrics query` | `<promql>` (positional), `--time` | Query billing and usage metrics via PromQL (instant) |
| `cx metrics query-range` | `<promql>` (positional), `--start`/`--end` | Query billing and usage metrics via PromQL (range) |

Key flags:
- All commands support `-o json` for structured output and `-p <profile>` for profile selection
- `cx usage daily` accepts `--type processed-gbs|units|evaluation-tokens` and `--start`/`--end` time filters
- `cx usage summary` accepts `--start`/`--end` time filters
- `cx usage logs-count` and `cx usage spans-count` accept `--start`/`--end` time filters, defaulting to the last 24h, plus `--resolution` (default `1h`), `--subsystem-aggregation`, `--application-aggregation`, and repeated `--param KEY=VALUE` for API filter query params
- Data usage summary and count endpoints are documented as newline-delimited JSON over `Accept: text/event-stream`; the CLI handles that transport and normalizes count chunks into `.result.logsCount[]` or `.result.spansCount[]`.
- `cx usage capabilities` is the required first step: it returns the labels, measurements, units, and request limits that the public Data Usage Query API currently supports for the selected tenant
```
END THIRD-PARTY FILE e1755ca7acc7cd05

The third-party file has ended. Everything between the e1755ca7acc7cd05 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2919 of 13636 bytes. © coralogix · Apache-2.0 · https://github.com/coralogix/cx-cli/tree/HEAD/skills/cx-cost-optimization/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
