npx skills add ...
npx skills add dynatrace/dynatrace-for-ai --skill dt-obs-logs
Log querying, filtering, pattern analysis, and error rate calculation. Use when searching application or infrastructure logs, analyzing error patterns, or correlating log data. Trigger: "show error logs", "search logs for keyword", "log error rate", "recent errors", "logs from last hour", "find log entries", "top error messages", "log patterns", "parse JSON logs", "logs by process group", "log trends over time", "log entry counts per minute". Do NOT use for explaining existing queries, product documentation questions, distributed tracing or span analysis (use dt-obs-tracing).
npx skills add dynatrace/dynatrace-for-ai --skill dt-obs-logs
Query, filter, and analyze Dynatrace log data using DQL for troubleshooting and monitoring.
Cross-source join required: If the query must combine logs with host attributes (OS type, hostname, IP address, cloud provider) → also read
dt-dql-essentials/references/smartscape-topology-navigation.mdbefore writing the query.
Use this skill when users want to:
from:now() - <duration> for time windowsmatchesPhrase() and contains() for content searchFind specific log entries by time, severity, and content.
Typical steps:
Example:
Narrow down logs using multiple criteria (severity, entity, content).
Typical steps:
Example:
Identify patterns, trends, and anomalies in log data.
Typical steps:
Example:
filter status == "ERROR" - Filter by status levelin(status, {"ERROR", "FATAL", "WARN"}) - Multi-status filter (use curly braces for literal sets)contains(content, "keyword") - Simple substring searchmatchesPhrase(content, "exact phrase") - Full-text phrase searchdt.process_group.detected_name - Get human-readable process group namefilter process_group == "service-name" - Filter by specific entitycount() - Count all log entriescountIf(condition) - Conditional countby: {dimension} - Group by entity or time bucketbin(timestamp, 5m) - Time bucketing for trendsfields timestamp, content, status - Select specific fieldsfieldsAdd name = expression - Add computed fieldsif(condition, true_value, else: false_value) - Conditional logicSimple substring search:
Full-text phrase search:
Calculate error rates over time:
Find most common errors:
Filter logs by process group:
Many applications emit JSON-formatted log lines. Use parse to extract fields instead of dumping raw content:
Aggregate by a parsed field:
Notes:
parse content, "JSON:log" creates a record field log — access nested values with log[key]contains() before parse to reduce parsing overheadcontentfrom:now() - <duration> to limit datacontains() for simple, matchesPhrase() for exact| limit 100 to prevent overwhelming outputdt.process_group.detected_name or getNodeName() for human-readable outputbin(timestamp, 5m) for time-series analysisdt.process_group.id for service correlationbin() and time rangesmatchesPhrase()summarize and conditional functionsmatchesPhrase) may have performance implications on large datasets| Problem | Cause | Solution |
|---|---|---|
| No logs returned | Missing time range or too narrow | Widen from: window; verify log ingestion is active |
getNodeName() returns null | OneAgent not monitoring the entity or entity not yet resolved | Verify OneAgent is deployed and entity is discovered; use dt.process_group.detected_name as a reliable alternative |
matchesPhrase() slow on large data | Full-text search without pre-filtering | Add filter status == "ERROR" before matchesPhrase() |
Wrong field name log.level | Common mistake | Use loglevel (no dot) for severity; see dt-dql-essentials |
Empty content field | Log line was empty or not ingested | Check log source configuration in OneAgent |