Loading...
Loading...
Use this skill when the user asks to "check data usage", "list TCO policies", "view quotas", "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", "quota rules", "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.
npx skill4agent add coralogix/cx-cli cx-cost-optimization| Command | Subcommands | Purpose |
|---|---|---|
| | Measure current data consumption |
| | Manage TCO (Total Cost of Ownership) policies |
| | Manage data retention periods |
| | Set ingestion guardrails |
| | Configure logs archive target |
| | Configure metrics archive storage |
| | Query billing and usage metrics via PromQL (instant) |
| | Query billing and usage metrics via PromQL (range) |
-o json-p <profile>cx usage daily--type processed-gbs|units|evaluation-tokens--start--endcx usage summary--start--endcx tco create/updatecx retentions updatecx quotas create/updatecx archive logs setcx archive metrics create/update/validate--from-file <path>-cx usage summary -o json
cx usage summary --start now-30d -o json
cx usage daily --type processed-gbs --start now-7d -o json
cx usage logs-count -o json
cx usage spans-count -o jsonjqcx usage summary -o json | jq '[.[] | {name, daily_avg: .avg_daily_gb}] | sort_by(.daily_avg) | reverse'cx tco list -o json
cx tco settings -o jsoncx tco list -o json | jq '.[] | select(.priority == "LOW") | {name, application, subsystem, archive_retention}'cx retentions list -o json
cx retentions status -o jsoncx quotas get -o jsoncx archive logs get -o json
cx archive metrics get -o json| Symptom | Diagnosis Command | Optimization |
|---|---|---|
| High-volume low-value logs | | Move to archive tier via |
| Long retention on cold data | | Reduce retention with |
| Burst ingestion spikes | | Add quota rules with |
| No cold storage configured | | Enable archive with |
| Expensive metrics not queried | | Enable metrics archiving with |
# Top consumers by daily volume
cx usage summary -o json | jq '[.[] | {name, daily_avg: .avg_daily_gb}] | sort_by(.daily_avg) | reverse | .[0:10]'
# Daily trend for the past week
cx usage daily --type processed-gbs --start now-7d -o json | jq '[.[] | {date, gb: .processed_gbs}]'
# Total logs and spans counts
cx usage logs-count -o json | jq '.total_count'
cx usage spans-count -o json | jq '.total_count'# Policies routing to archive tier
cx tco list -o json | jq '[.[] | select(.archive_retention != null)]'
# Policies by priority
cx tco list -o json | jq 'group_by(.priority) | map({priority: .[0].priority, count: length})'
# Test if a log pattern matches a policy
cx tco test --from-file test-definition.json -o json# All retention settings
cx retentions list -o json | jq '.[]'
# Check if retention is active
cx retentions status -o json# Current quota rules
cx quotas get -o json | jq '.rules // empty'# Logs archive configuration
cx archive logs get -o json | jq '{active: .active, bucket: .bucket}'
# Metrics archive configuration
cx archive metrics get -o json | jq '{enabled: .enabled, bucket: .bucket}'--yes--yes--yes--read-onlyCX_READ_ONLY=1--yescx tco get <policy-id> -o json > policy.json
# Edit policy.json
cx tco update --from-file policy.jsoncx tco reorder --from-filecx usage| Metric | Meaning | Query suffix |
|---|---|---|
| Daily billable usage in units (canonical billing metric) | No |
| Current daily plan quota in units (snapshot) | No |
| Daily overage/PAYG usage in units | No |
| Processed data size in bytes | |
| AI evaluation tokens | |
| Processed metric samples | |
cx_data_usage_unitscx_data_plan_units_per_daycx_data_usage_totalcx_data_usage_tokens_totalcx_data_usage_samples_totalcx_data_usage_payg_units# Today's billable units consumed so far
cx metrics query 'sum(cx_data_usage_units)' --time now -o json
# Units breakdown by pillar
cx metrics query 'sum by (pillar) (cx_data_usage_units)' --time now -o json
# Daily plan quota
cx metrics query 'cx_data_plan_units_per_day' --time now -o json
# Plan consumption percentage
cx metrics query '100 * sum(cx_data_usage_units) / cx_data_plan_units_per_day' --time now -o json
# Units by feature group
cx metrics query 'sum by (feature_group_id) (cx_data_usage_units)' --time now -o json
# PAYG overage (if any)
cx metrics query 'cx_data_usage_payg_units' --time now -o json00:00 UTCmeasurement_typepillarentity_typepriorityfeature_group_idapplication_namesubsystem_namecx_data_usage_unitscx_data_usage_totalpillarentity_typeprioritymeasurement_typefeature_group_idfeature_idapplication_namesubsystem_name-o json-p <profile>--all-profilescx-telemetry-queryingcx-query-logscx-metrics-query