dd-logs

작성자: datadog-labs

로그 관리 - 검색, 파이프라인, 아카이브 및 비용 제어.

npx skills add https://github.com/datadog-labs/pup --skill dd-logs

Datadog Logs

Search, process, and archive logs with cost awareness.

Prerequisites

Datadog Pup (dd-pup/pup) should already be installed:

cargo install --git https://github.com/DataDog/pup

Quick Start

pup auth login

Search Logs

# Basic search
pup logs search --query="status:error" --from="1h"

# With filters
pup logs search --query="service:api status:error" --from="1h" --limit 100

# JSON output is the default
pup logs search --query="@http.status_code:>=500" --from="1h"

Search Syntax

QueryMeaning
errorFull-text search
status:errorTag equals
@http.status_code:500Attribute equals
@http.status_code:>=400Numeric range
service:api AND env:prodBoolean
@message:*timeout*Wildcard

Trace IDs in Log Results

Logs that show a linked trace in the Datadog UI may not include dd.trace_id / dd.span_id in API results. When a trace ID attribute is remapped for trace correlation (via JSON preprocessing or a Trace Remapper processor), the source attribute is removed and the value is stored as an internal attribute that the Logs Search API does not return. The UI's "trace" link reads that internal attribute, so UI and API results differ.

This is expected Datadog Log Management behavior, not a pup bug or an instrumentation problem. Do not retry queries or change instrumentation to "fix" it. Datadog is tracking making these values queryable (support reference FRLOGSS-4306).

Workarounds until then:

  • Emit the trace ID under a separate attribute that is not remapped (e.g. @custom.trace_id) and query that.
  • Pivot the other way: search spans by the log's service/time window via pup traces search, or use the trace link in the Datadog UI.

Pipelines

Process logs before indexing:

# List pipelines
pup obs-pipelines list

# Create pipeline (JSON)
pup obs-pipelines create --file pipeline.json

Common Processors

{
  "name": "API Logs",
  "filter": {"query": "service:api"},
  "processors": [
    {
      "type": "grok-parser",
      "name": "Parse nginx",
      "source": "message",
      "grok": {"match_rules": "%{IPORHOST:client_ip} %{DATA:method} %{DATA:path} %{NUMBER:status}"}
    },
    {
      "type": "status-remapper",
      "name": "Set severity",
      "sources": ["level", "severity"]
    },
    {
      "type": "attribute-remapper",
      "name": "Remap user_id",
      "sources": ["user_id"],
      "target": "usr.id"
    }
  ]
}

⚠️ Exclusion Filters (Cost Control)

Index only what matters:

{
  "name": "Drop debug logs",
  "filter": {"query": "status:debug"},
  "is_enabled": true
}

High-Volume Exclusions

# Find noisiest log sources
pup logs search --query="*" --from="1h" | jq 'group_by(.service) | map({service: .[0].service, count: length}) | sort_by(-.count)[:10]'
ExcludeQuery
Health checks@http.url:"/health" OR @http.url:"/ready"
Debug logsstatus:debug
Static assets@http.url:*.css OR @http.url:*.js
Heartbeats@message:*heartbeat*

Archives

Store logs cheaply for compliance:

# List archives
pup logs archives list

# Archive config (S3 example)
{
  "name": "compliance-archive",
  "query": "*",
  "destination": {
    "type": "s3",
    "bucket": "my-logs-archive",
    "path": "/datadog"
  },
  "rehydration_tags": ["team:platform"]
}

Log-Based Metrics

Inspect log-based metrics:

# List existing log-based metrics
pup logs metrics list

⚠️ Cardinality warning: Group by bounded values only.

Sensitive Data

Scrubbing Rules

{
  "type": "hash-remapper",
  "name": "Hash emails",
  "sources": ["email", "@user.email"]
}

Never Log

# In your app - sanitize before sending
import re

def sanitize_log(message: str) -> str:
    # Remove credit cards
    message = re.sub(r'\b\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b', '[REDACTED]', message)
    # Remove SSNs
    message = re.sub(r'\b\d{3}-\d{2}-\d{4}\b', '[REDACTED]', message)
    return message

Troubleshooting

ProblemFix
Logs not appearingCheck agent, pipeline filters
High costsAdd exclusion filters
Search slowNarrow time range, use indexes
Missing attributesCheck grok parser
dd.trace_id missing but UI shows a traceExpected: remapped trace IDs become internal attributes (see Trace IDs in Log Results)

References/Documentation

datadog-labs의 다른 스킬

dd-audit
datadog-labs
감사 추적 조사 - 누가 무엇을 변경했는지, 키 손상, 비용 급증 근본 원인, 규정 준수 증거(SOC 2/PCI), AI 활동 감사.
official
agent-install
datadog-labs
Datadog Operator를 사용하여 Kubernetes에 Datadog Agent를 설치합니다 — Single Step Instrumentation(SSI)을 활성화하기 전에 필요하며, 이는 자동으로…
official
agent-observability-auto-experiment
datadog-labs
실제 Datadog LLM-Obs 데이터를 대상으로 반복적 코드 개선 힐클라임을 로컬에서 Claude Code를 에이전트로 사용하여 실행합니다. 기준 평가를 설정하고, 하나의…
official
agent-observability-eval-bootstrap
datadog-labs
프로덕션 트레이스에서 평가자를 부트스트랩합니다 — 기본적으로 온라인 LLM-판정 평가자를 제안하고, 확인 후 Datadog에 비활성화된 초안으로 생성합니다…
official
agent-observability-eval-pipeline
datadog-labs
계측된 ml_app을 위한 엔드투엔드 에이전트 관측성 파이프라인 — 프로덕션 트레이스를 분류하고, 실패의 근본 원인을 분석하며, 평가기를 부트스트랩한 다음, (선택적으로)…
official
agent-observability-experiment-analyzer
datadog-labs
LLM 실험 결과를 분석합니다. 단일 또는 비교 실험, 탐색적 또는 Q&A 모드를 처리합니다. 사용자가 "실험 분석", "비교…"라고 말할 때 사용하세요.
official
agent-observability-replay-trace
datadog-labs
개발자가 마음에 들지 않는 출력을 생성한 특정 Agent Observability / LLM Obs 트레이스 하나를 반복 작업하고자 할 때 사용합니다 — 해당 트레이스를 다시 실행하여…
official
agent-observability-trace-rca
datadog-labs
프로덕션 LLM 트레이스에 대한 근본 원인 분석. LLM 애플리케이션이 실패하는 이유를 진단하며, 평가 판정, 런타임 오류 또는 구조적 문제를 기반으로 작동합니다…
official