Logs and problems in Dynatrace¶
This page shows how we look at what the running services are saying, with sfe: which Dynatrace we are connected to, which problems Dynatrace has raised, how many errors each application logged, the name of a service, and how to read log lines with care. Dynatrace is the monitoring tool where our services send their logs and where problems are detected. Everything on this page only reads.
Video, about two and a half minutes, with narration and captions.
Before you start¶
- sfe is installed and our pack is on. If it is not, we do that first: The path at a glance.
- We are signed in to Dynatrace. Sign in to Dynatrace shows how, and
sfe statussays whether it worked. - We know that log lines can hold a student's name, email or id. Every log command below is one we read first on our own screen. Before we share or record one, we check the whole answer.
Warning
A log search that prints the message of each line is not safe to put in a screenshot, a ticket or a chat. On this page, the log search asks for only the time of each line, so no message is on the screen. The log text is intentionally not shown here.
Steps¶
1. Open a terminal¶
We open the Terminal app on the Mac. It does not matter which folder we are in.
2. See which Dynatrace we are connected to¶
A context is one Dynatrace environment together with its saved login. We list them:

We have wgu-prod for production and wgu-nonprod for everything else. The star marks the one sfe uses unless we say otherwise. Both say readonly in the SafetyLevel column, so Dynatrace itself refuses a change from here. The option -e nonprod picks the other one for a single command.
3. Read the problems¶
Dynatrace has an engine called Davis that opens a problem when it sees something unusual, for example a service that answers slowly. sfe dt problems lists them. We ask for the last 24 hours and keep three:

Each problem shows:
| Row | What it tells us |
|---|---|
problem |
The display id, P- and a number. It is the id people paste into Teams |
status |
ACTIVE while it is open, CLOSED once Dynatrace saw it recover |
name |
What Dynatrace thinks is wrong |
affected |
The service, process or server it is about |
updates |
How many times Dynatrace updated the problem |
first and last |
When it started, and when it was last updated |
4. Count the errors by application¶
A count is safe to show, because it has no log text in it. Dynatrace has its own query language, called DQL, that reads like a pipeline: we fetch the logs, keep some, and sum them up. sfe dt query runs one. Here we keep the errors from the last hour, count them by application, sort the biggest first, and keep five:
sfe dt query 'fetch logs, from:now()-1h | filter loglevel == "ERROR" and isNotNull(application) | summarize n = count(), by:{application} | sort n desc | limit 5'

We type the whole query inside single quotes. The answer is the name of each application and n, the number of error lines. A number that is far bigger than usual for one application tells us where to look next.
5. Find a service by name¶
Logs and traces belong to a service. sfe dt services finds services whose name contains a word. We use orc and keep six:

The id column is the service id, which starts with SERVICE-. mesaenrollment-orc is the ORC service itself.
6. Search logs, with care¶
sfe dt logs searches log lines by service, level and time window. Before we run any log search that we want to record or share, we run it once on our own screen and read the whole answer, because the message of a line can hold student data.
For this page we ask for only two fields, the time and the level, with --fields. That way the screen shows no message:

We see three times and nothing else, so we know three error lines exist in the last hour. The empty brackets are where sfe prints the level and the message, and with only these two fields they come out empty. The message is intentionally not shown on this page.
In real work we leave --fields off and read the message on our own screen, and we keep --limit small so the answer stays short. The other options are:
| Option | What it does |
|---|---|
--service |
The service or container name, for example orc |
--level |
The log level, for example ERROR |
--since |
The time window, such as 30m, 6h or 7d |
--limit |
The most rows to print |
--contains |
Keeps lines whose text contains these words |
--fields |
Which parts of each line to print |
More commands¶
These are in sfe help dt. We did not record them here, so we only name them:
| Command | What it does |
|---|---|
sfe dt errors <service> |
The failed requests of one service in a time window |
sfe dt trace <traceId> |
Every step of one request, by its trace id |
sfe dt nl2dql <text> |
Turns a plain English question into DQL. It does not run it. It needs a Dynatrace DPS subscription with Copilot; without one Dynatrace answers 403, and sfe says to write the DQL with sfe dt query |
A service often goes by more than one name: the one Dynatrace gives it (application-1), the one it reports itself, and the name of what runs it (work-based-learning). sfe dt errors and sfe dt logs --service look in all of them, without regard to capitals, so either name finds it.
A table cuts long values, such as a stack trace, and says so under it. To see them whole we add --json; -o json works too.
What we should see¶
read-onlyin green on every answer, and a redPRODUCTIONlabel.- No student name, email or id on the screen. If we see one, we do not copy it anywhere.
Troubleshooting¶
| What we see | Likely cause | What to do |
|---|---|---|
login needed, and the exit code is 4 |
The Dynatrace sign-in has expired | Run sfe doctor. It names the problem and the exact fix. Passwords and codes are always typed by us |
(no rows) |
Nothing matched in that window | Widen --since, or check the service name with sfe dt services |
long values are cut here under a table |
A field such as a stack trace is wider than the column | Run the same command with --json |
dt nl2dql needs a Dynatrace DPS subscription |
The tenant has no Copilot | Write the DQL and run it with sfe dt query |
| The answer is very wide | The table has many columns | sfe prints one row as a short list instead. Make the window wider if we need a table |
| The answer shows the wrong environment | We are on production and wanted non-production | Add -e nonprod to the command, and check the label at the top |
| A log answer is full of JSON | That service writes its requests as JSON lines, with headers and bodies | We do not record it or share it. We use --fields, or count with sfe dt query instead |
Next¶
- The ORC database, for read-only questions about the student application data.
- Search every system at once, for when we only have a few words from an error.
Last reviewed: 2026-12-03