dd-logs
작성자: datadog-labs
로그 관리 - 검색, 파이프라인, 아카이브 및 비용 제어.
npx skills add https://github.com/datadog-labs/pup --skill dd-logsDatadog 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
| Query | Meaning |
|---|---|
error | Full-text search |
status:error | Tag equals |
@http.status_code:500 | Attribute equals |
@http.status_code:>=400 | Numeric range |
service:api AND env:prod | Boolean |
@message:*timeout* | Wildcard |
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]'
| Exclude | Query |
|---|---|
| Health checks | @http.url:"/health" OR @http.url:"/ready" |
| Debug logs | status: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
| Problem | Fix |
|---|---|
| Logs not appearing | Check agent, pipeline filters |
| High costs | Add exclusion filters |
| Search slow | Narrow time range, use indexes |
| Missing attributes | Check grok parser |
References/Documentation
datadog-labs의 다른 스킬
agent-install
datadog-labs
agent-install — Datadog-labs/agent-skills에서 게시한 AI 에이전트용 설치 가능한 스킬입니다.
official
agent-skills
datadog-labs
AI 에이전트를 위한 Datadog 스킬. 필수 모니터링, 로깅, 트레이싱 및 관찰 가능성.
official
dd-apm
datadog-labs
APM - 설치, 온보딩, 계측, 활성화, 설정, 구성, 트레이스, 서비스, 종속성, 성능 분석. Datadog APM과 관련된 모든 요청에 사용합니다…
official
dd-audit
datadog-labs
감사 추적 조사 - 누가 무엇을 변경했는지, 키 손상, 비용 급증 근본 원인, 규정 준수 증거(SOC 2/PCI), AI 활동 감사.
official
dd-audit-ai-activity
datadog-labs
Bits AI 어시스턴트(MCP 서버)가 Datadog 조직에서 수행한 작업을 감사합니다 — 사용자별 도구 호출, 액세스한 리소스, AI 거버넌스를 위한 이상 플래그.
official
dd-audit-compliance-report
datadog-labs
Datadog Audit Trail에서 SOC 2 및 PCI DSS에 대한 감사자 준비 완료 규정 준수 증거를 생성합니다. 프레임워크 컨트롤을 특정 쿼리 패턴에 매핑하고 다음을 생성합니다…
official
dd-audit-cost-spike-investigation
datadog-labs
Datadog 제품 사용량 또는 비용 급증을 조사하기 위해 사용량 측정 데이터(언제/무엇이 급증했는지)를 감사 추적 구성 변경 사항(누가 무엇을 변경했는지)과 연관시킵니다.
official
dd-audit-key-compromise
datadog-labs
잠재적으로 유출된 Datadog API 키를 조사합니다 — 작업 타임라인, 지리/IP 분석, 호출된 엔드포인트, 이상 징후 플래그 및 복구 단계.
official