Mean Time to Detect (MTTD): How to Measure It and What It Misses
What mean time to detect (MTTD) measures, how to calculate it from your case data, why the start time is the hard part, what drives it up, and why a falling MTTD can hide poor coverage.
Last reviewed December 2026
Mean time to detect (MTTD) is the average time between the start of malicious activity in your environment and the moment your security team detects it, calculated across the incidents you detected over a period.
MTTD is one of the most reported SOC metrics and one of the easiest to misread. The arithmetic is simple. The inputs are not, and the metric has a blind spot built into it: it only counts the attacks you caught. This guide covers how to calculate MTTD, how to pull it from your own case data, what pushes it up, how to bring it down, and what to measure alongside it so the number means something. It is part of our guide to SOC automation, which covers the wider set of SOC metrics.
The MTTD formula
For each incident, detection time is:
time to detect = time of detection - time malicious activity started
MTTD is the average of that value across every incident in the period:
MTTD = sum(time to detect for each incident) / number of incidents
Two definitions need pinning down before the number is useful.
- Start of malicious activity. The earliest attacker action you can attribute to the incident: the phishing email being opened, the first login with stolen credentials, the first execution of a malicious binary. Not the start of reconnaissance you could never have seen, and not the moment someone noticed something odd.
- Time of detection. Most teams use the first alert that was later tied to the incident. Some use the moment an analyst confirmed it was real. Either works if you pick one and keep it. The second folds triage time into MTTD, which makes it harder to compare with anyone else's number.
A worked example
Say your SOC handled five confirmed incidents last quarter:
| Incident | Activity started | First alert | Time to detect |
|---|---|---|---|
| Phishing, credential entry | Mon 09:10 | Mon 09:50 | 40 min |
| Malicious macro execution | Tue 14:00 | Tue 15:15 | 1 h 15 min |
| Suspicious OAuth app consent | Wed 08:00 | Wed 12:00 | 4 h |
| Brute force, then successful login | Thu 22:00 | Fri 08:00 | 10 h |
| Compromised service account | Day 1, 03:00 | Day 10, 03:00 | 9 days |
Converted to minutes: 40, 75, 240, 600 and 12,960. The total is 13,915 minutes, so:
MTTD = 13,915 / 5 = 2,783 minutes, or about 46 hours
An MTTD of nearly two days describes none of these incidents. Four were detected within ten hours. One took nine days. That gap is the next problem.
Median vs mean
Detection times are skewed. Most incidents are caught quickly by a working rule, and a few slip past everything until something unrelated turns them up. One long incident drags the mean far away from the typical case.
In the example above, the median time to detect is 4 hours: the middle value when the five are sorted. That is a much better description of how quickly your SOC usually detects.
Report both, and look at what makes them differ:
- The median tells you how your detection pipeline performs on the incidents it handles routinely.
- The mean, and the slowest few incidents behind it, tell you where the pipeline failed. The nine-day service account compromise is worth more attention than the other four combined.
A 90th percentile is also useful once you have enough incidents for it to be stable. With five incidents a quarter, it is not; list the outliers by name instead.
Why the start time is the hard part
The detection timestamp comes from your SIEM or case system and is exact. The start timestamp usually comes from the investigation, and it is an estimate.
When an alert fires, nobody yet knows when the activity began. The analyst works backwards through logs to find the earliest related event, and how far back they get depends on:
- Log retention. If the earliest activity is older than your retention window, it is gone, and the start time you record is wrong by an unknown amount.
- Data coverage. If the first attacker action happened on a system that does not send logs, the investigation finds the first action you can see.
- Investigation depth. A quickly closed incident gets a rough start time. A full incident response engagement gets a careful one.
Every one of these errors makes MTTD look better than it is. The investigation can only find a start time where data exists, so missing data shortens the measured window. Record how the start time was established (log evidence, forensic analysis, best estimate) on each case, so you know which numbers to trust.
MTTD and related metrics
MTTD is one segment of the incident timeline. The others are measured from different start and end points, and teams define them inconsistently, so write your definitions down.
| Metric | Measured from | Measured to | What it tells you |
|---|---|---|---|
| MTTD (mean time to detect) | Start of malicious activity | First alert or detection | How long attackers operate before you know |
| MTTA (mean time to acknowledge) | Alert raised | An analyst picks it up | How long alerts wait in the queue |
| MTTR (mean time to respond) | Alert or detection | Containment (some teams measure to full remediation) | How quickly you act once you know |
| Mean time to contain | Start of malicious activity, or detection, depending on the team | Threat contained | Total exposure, when measured from the start |
| Dwell time | Start of malicious activity | Detection, or eviction, depending on the source | How long an attacker was present; often used per incident rather than averaged |
MTTD and dwell time overlap heavily. When dwell time is measured to detection, the average dwell time across your incidents is your MTTD. When it is measured to eviction, it is roughly MTTD plus MTTR.
How to measure MTTD from your case data
You need two timestamps on every confirmed incident: when the activity started and when it was detected. Most case and ticketing systems record the second automatically. The first usually needs a dedicated field that analysts fill in when they close the case.
With those fields in place, the query is short. In SQL against an exported cases table:
SELECT
COUNT(*) AS incidents,
AVG(EXTRACT(EPOCH FROM (first_alert_at - activity_started_at)) / 3600)
AS mttd_mean_hours,
PERCENTILE_CONT(0.5) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (first_alert_at - activity_started_at)) / 3600
) AS mttd_median_hours
FROM cases
WHERE disposition = 'true_positive'
AND activity_started_at IS NOT NULL
AND closed_at >= DATE '2026-07-01'
AND closed_at < DATE '2026-10-01';
A few rules keep the number honest:
- Count confirmed incidents only. False positives have no malicious start time.
- Report how many cases were excluded for a missing start time. If half your incidents lack one, the MTTD covers the half that was investigated properly.
- Break it down by detection source, ATT&CK tactic or log source. A single MTTD hides the fact that endpoint detections fire in minutes and cloud identity detections take days. Mapping incidents to MITRE ATT&CK makes the slow areas visible.
- Keep the definitions fixed. Changing what counts as "detected" partway through a year produces a trend that is an artifact of the change.
What drives MTTD up
Long detection times usually trace back to one of a few causes.
Missing data sources. A rule cannot fire on data the SIEM never receives. If the attacker's first actions happen in a SaaS app, a cloud control plane or a server that does not forward logs, detection waits until they reach something you do collect.
Broken rules. A rule that is enabled but cannot match, because a field was renamed, a log source changed format or a lookup table went stale, raises no alert and no error. In our Detection Debt Report, 29% of deployed, enabled rules were broken. Every incident one of those rules should have caught gets caught later by something else, or not at all.
Rule schedules and look-back windows. Many SIEM rules run on a schedule, every 5 minutes, every hour or once a day, over a fixed look-back window. A rule that runs hourly adds up to an hour to detection on its own. Worse, if ingestion is delayed and events arrive after the window has passed, a scheduled rule can miss them entirely. Look-back windows need to cover ingestion lag, not just the run interval.
Queue time. If time of detection is when an analyst confirms the incident, every minute an alert sits unread counts against MTTD. Alert volume and noise drive this directly; our guide to alert triage covers it.
Detection logic that needs the attack to progress. Some rules only match late-stage behavior, such as mass file encryption or large outbound transfers. They are worth having, and they guarantee a long time to detect for anything they catch.
How to reduce MTTD
Work through the causes in roughly the order they cost you.
- Fix broken detections first. A broken rule is a guaranteed miss. Test that each enabled rule still matches the data it targets, and repeat the check whenever log sources or parsers change. Our post on detection health covers how to check.
- Close data gaps for the threats you care about. Start from the techniques you have decided matter, work out which log sources would show them, and confirm those sources arrive, parse and are retained long enough to investigate.
- Add earlier-stage detections. If most incidents are caught at impact, write rules for initial access, persistence and privilege escalation in the same attack paths. Detection engineering is the discipline for doing this deliberately.
- Tighten schedules where it matters. Run high-value rules more often or as streaming rules where your SIEM supports it, and set look-back windows that cover real ingestion delay.
- Cut the queue. Tune noisy rules at the source and automate enrichment, so real alerts reach an analyst sooner.
- Hunt. Threat hunting finds activity your rules missed. Each finding is an incident with a long time to detect, and a candidate for a new rule so the next one is caught sooner.
The big caveat: MTTD only counts what you caught
MTTD is calculated over detected incidents. An attack you never detected is not in the data at all. It does not count as a long time to detect. It does not count.
That is survivorship bias, and it means MTTD can improve while your security gets worse. Suppose a log source quietly stops arriving and the rules that depend on it go silent. The slow, hard incidents those rules would eventually have caught disappear from your incident list. What remains are the quick catches from your healthiest detections, and MTTD falls. The dashboard shows a win.
The same thing happens when a team tunes away a noisy rule that occasionally caught something real, or when attackers shift to techniques you have no detections for. Fewer incidents, faster detection, worse coverage.
So MTTD should never be reported alone. Pair it with measures of what you would catch, not just how fast you caught what you did:
- Coverage validation. For the techniques that matter to you, confirm that a working detection exists, that it runs against data you actually collect, and that the data is arriving.
- Simulated attacks and purple-team exercises. Run the technique in a controlled way and record whether it was detected and how long it took. This gives you a time to detect for attacks you chose, including the ones your rules miss, which is exactly what MTTD from real incidents cannot show.
- Detection health over time. Track the share of enabled rules that would fire if the behavior happened today. A drop here predicts a future MTTD problem that real incidents will not reveal until it is too late.
A falling MTTD alongside stable or improving coverage is real progress. A falling MTTD alongside shrinking coverage is a measurement artifact.
Where to go next
MTTD is most useful as a check on detection quality, and detection quality is the part most SOCs measure least. Spectrum focuses there: it tests whether your deployed rules still work against your data and recommends coverage for the threats that matter to you, which addresses the causes of slow detection and the blind spot MTTD cannot see.
For the rest of the SOC metrics picture, and how speed and quality measures fit together, read the SOC automation guide.
Related guides
See what your environment is actually detecting
Spectrum maps your coverage, builds the detections you are missing, and keeps them working.