RousselTMLEARNING

Observability

DQL in practice: exploring logs and events, notebooks, dashboards and performance

Use the Dynatrace Query Language day to day: explore logs and events, chain commands, parse fields, create time series, share in notebooks and dashboards, and write efficient queries.

1. Exploring logs and events #

First queries.

Basic commands #

DQL pipeline
Each command receives the result of the previous one.
fetch logs, from: now() - 2h
| filter loglevel == "ERROR" and k8s.namespace.name == "boutique"
| summarize erreurs = count(), by: {dt.entity.service}
| sort erreurs desc
| limit 10
fetch events, from: now() - 24h
| filter event.kind == "DAVIS_PROBLEM"
| fields timestamp, event.name, event.status, affected_entity_ids

Common sources: logs, events, bizevents, spans, dt.entity.* (entities) and time series with timeseries.

2. Enriching queries #

Parsing and transforming.

Examples #

// Extraire des champs d'un log texte (DPL)
fetch logs
| filter matchesPhrase(content, "paiement")
| parse content, "LD 'montant=' INT:montant LD 'client=' WORD:client"
| summarize total = sum(montant), by: {client}

// Transformer des logs en série temporelle
fetch logs
| filter loglevel == "ERROR"
| makeTimeseries erreurs = count(), by: {dt.entity.service}, interval: 5m

// Relier traces et logs
fetch spans
| filter duration > 2s and service.name == "checkout"
| fields trace.id, span.name, duration

Notebooks and dashboards #

A notebook chains queries, graphs and text: ideal for a shared investigation or post-mortem. A validated query can be turned into a dashboard tile, possibly with variables (service, namespace).

Good practice: Davis CoPilot can generate a DQL query from a natural-language question: a good starting point, to review before saving.

3. Writing efficient queries #

Reading less data.

Best practices #

RuleWhy
Short time rangeThe amount of data read depends first on the period
Filter early, on indexed or bucket fieldsReduces the volume analyzed by the following commands
fields / fieldsKeep to keep only what is usefulLess data to carry and display
summarize rather than reading thousands of rowsThe computation happens in Grail
limit at the end of the queryAvoids huge results
Prefer matchesPhrase to contains on textMakes better use of indexes
Common mistake: Depending on the license model, log queries may be billed by volume read: an unfiltered 30-day query run every minute by a dashboard is expensive. See also the article « Grail: Dynatrace Data Lakehouse ».

Related articles

Accessing the Dynatrace playground and getting started

The Dynatrace playground is a demo environment full of real data: how to access it, what it allows and does n…

Grail buckets in Dynatrace: creation, routing, retention, rights and costs

Complete guide to Grail buckets: purpose, default buckets, creation in Storage management, with the API or Te…

The Dynatrace QuickStart app: getting your first data in minutes

Discover the QuickStart app: add data with Auto Discovery or a dedicated tile, read Findings, explore with da…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!