detect-anomalies

작성자: axiomhq

Axiom 데이터셋에서 통계적 분석을 사용하여 이상 징후를 탐지합니다. 비정상적인 패턴, 볼륨 급증, 이상치 또는 새로운 오류 유형을 찾을 때 사용하세요.

npx skills add https://github.com/axiomhq/cli --skill detect-anomalies

Anomaly Detection

Detect anomalies in Axiom datasets by comparing recent patterns to historical baselines using statistical analysis.

Arguments

When invoked with a dataset name (e.g., /detect-anomalies logs), it's available as $ARGUMENTS.

Prerequisites

Statistical anomaly detection requires sufficient data:

  • Minimum data points: Z-score and standard deviation need ≥30 samples per bucket for statistical significance
  • Historical baseline: At least 24 hours of data for meaningful comparison (methods use 25h lookback)
  • Consistent ingestion: Gaps in data collection will skew baselines

If these aren't met, results may be misleading. Consider using simpler threshold-based alerting instead.

Schema Discovery

Always verify field names first:

axiom query "['<dataset>'] | getschema" --start-time -1h

Anomaly Detection Methods

1. Volume Anomaly Detection

Compare recent volume to baseline:

Calculate baseline (past 24h excluding last hour):

axiom query "['<dataset>']
| where _time between (ago(25h) .. ago(1h))
| summarize count() by bin(_time, 1h)
| summarize
    avg_hourly = avg(count_),
    stdev_hourly = stdev(count_)" --start-time -25h -f json

Check recent volume:

axiom query "['<dataset>']
| where _time >= ago(1h)
| summarize
    current_count = count(),
    current_hour = min(_time)" --start-time -1h -f json

Z-score calculation:

  • z_score = (current - avg) / stdev
  • |z_score| > 2 indicates anomaly

2. New Value Detection

Find values that appeared recently but weren't seen before:

axiom query "['<dataset>']
| where _time >= ago(1h)
| summarize by error_code
| join kind=leftanti (
    ['<dataset>']
    | where _time between (ago(25h) .. ago(1h))
    | summarize by error_code
  ) on error_code" --start-time -25h -f json

Replace error_code with any categorical field (service, endpoint, status).

3. Statistical Outliers

Find values outside normal distribution:

Calculate bounds:

axiom query "['<dataset>']
| where _time between (ago(25h) .. ago(1h))
| summarize
    avg_val = avg(duration),
    stdev_val = stdev(duration)
| extend
    lower_bound = avg_val - 3 * stdev_val,
    upper_bound = avg_val + 3 * stdev_val" --start-time -25h -f json

Find outliers:

axiom query "['<dataset>']
| where _time >= ago(1h)
| where duration < <lower_bound> or duration > <upper_bound>
| limit 100" --start-time -1h -f json

4. Rare Event Detection

Find infrequent occurrences:

axiom query "['<dataset>']
| where _time >= ago(1h)
| summarize count() by error_message
| where count_ == 1" --start-time -1h -f json

5. Error Rate Spike

Compare error rate to baseline:

axiom query "['<dataset>']
| where _time >= ago(6h)
| summarize
    total = count(),
    errors = countif(status >= 500)
  by bin(_time, 15m)
| extend error_rate = errors * 100.0 / total
| sort by _time asc" --start-time -6h -f json

6. Latency Degradation

Track percentile changes:

axiom query "['<dataset>']
| where _time >= ago(6h)
| summarize
    p50 = percentile(duration, 50),
    p95 = percentile(duration, 95),
    p99 = percentile(duration, 99)
  by bin(_time, 15m)
| sort by _time asc" --start-time -6h -f json

Anomaly Categories

TypeDetection MethodIndicates
Volume SpikeZ-score on countTraffic surge, attack, incident
Volume DropZ-score on countOutage, data collection issue
New ValuesLeft anti-joinNew errors, new services
Statistical Outlier3-sigma ruleExtreme performance issue
Rare EventsCount = 1Unusual conditions
Error SpikeError rate increaseService degradation
Latency SpikePercentile increasePerformance issue

Output Format

## Anomaly Report: <dataset>

### Summary
- Analysis period: <timeframe>
- Anomalies found: <count>

### Volume Anomalies
| Time | Count | Expected | Z-Score |
|------|-------|----------|---------|
| ... | ... | ... | ... |

### New Values
- Field: `error_code`
- New values: `TIMEOUT_ERROR`, `CONNECTION_REFUSED`

### Statistical Outliers
- Field: `duration`
- Outliers: <count> events above <threshold>

### Error Rate
- Baseline: X%
- Current: Y%
- Change: +Z%

### Recommendations
1. <Investigation action>
2. <Monitoring suggestion>

Investigation Priority

  1. Assess impact - Is this affecting users?
  2. Correlate timing - What changed when anomaly started?
  3. Check related systems - Shared dependencies?
  4. Verify data quality - Is it a real issue or data problem?

When NOT to Use

  • Insufficient data: Z-score needs ≥30 data points; new datasets lack meaningful baselines
  • Known thresholds: If you have specific SLOs (e.g., "p99 < 500ms"), use direct threshold queries
  • Real-time alerting: Use Axiom Monitors for continuous anomaly detection, not ad-hoc analysis
  • Single data point: Anomaly detection compares against distributions, not individual values

APL Reference

For query syntax, invoke the axiom-apl skill which provides anomaly detection patterns and function documentation.

axiomhq의 다른 스킬

axiom-apl
axiomhq
APL 쿼리 언어 레퍼런스 for Axiom. 연산자, 함수, 패턴 및 CLI 사용법을 제공합니다. 전문화된 Axiom 스킬에 의해 작성 시 자동 호출됩니다…
official
explore-dataset
axiomhq
Axiom 데이터셋을 탐색하여 스키마, 필드, 볼륨 및 패턴을 이해합니다. 새 데이터셋을 발견하거나 데이터 구조를 조사할 때 사용합니다.
official
find-traces
axiomhq
Axiom에서 OpenTelemetry 분산 트레이스를 분석합니다. 트레이스 ID를 조사하거나, 기준(오류, 지연 시간, 서비스)별로 트레이스를 찾거나, 디버깅할 때 사용하세요…
official
gilfoyle
axiomhq
당신이 할 수 없는 일을 해내는 SRE 에이전트. 관측 가능성 스택을 조회합니다. 근본 원인을 찾아냅니다. 당황하지 않습니다. 추측하지 않습니다. 당신의 감정에 신경 쓰지 않습니다. 사용…
official
axiom-sre
axiomhq
전문 SRE 조사관으로서 인시던트 및 디버깅을 수행합니다. 가설 기반 방법론과 체계적 트라이지를 사용합니다. 사용 가능 시 Axiom 관찰 가능성을 쿼리할 수 있습니다.…
official
building-dashboards
axiomhq
API를 통해 Axiom 대시보드를 설계하고 구축합니다. 차트 유형, APL 및 메트릭/MPL 쿼리 패턴, SmartFilters, 레이아웃, 구성 옵션을 다룹니다. 다음 경우에 사용하세요…
official
controlling-costs
axiomhq
Axiom 쿼리 패턴을 분석하여 사용되지 않는 데이터를 찾고, 비용 최적화를 위한 대시보드와 모니터를 구축합니다. Axiom 비용 절감, 미사용 데이터 찾기 요청 시 사용하세요.
official
query-metrics
axiomhq
스크립트를 통해 Axiom MetricsDB에 메트릭 쿼리를 실행합니다. 사용 가능한 메트릭, 태그 및 태그 값을 탐색합니다. 메트릭 쿼리, 메트릭 탐색 등을 요청받았을 때 사용하세요.
official