Security Fundamentals: Detect and Respond · 1 of 5
Logging, Monitoring and Detection
Logs record what happened, monitoring shows what is happening, and detection turns signals into action when something may be wrong.
Every reliable system leaves traces. A user signs in, a database rejects a query, a server runs out of memory, a firewall blocks a connection, and an application returns an error. Logging, monitoring, and detection are the disciplines of turning those traces into understanding. They are not the same job. Logging preserves facts, monitoring watches health, and detection looks for behavior that deserves investigation. Done well, they help teams fix outages, prove what occurred, and find attacks early. Done poorly, they create expensive noise, false confidence, and blind spots.
Start with events, not tools
An event is something that happened at a point in time. A person entered a password, a process opened a file, a container restarted, or a payment failed. A log is a written record of one or more events. The simplest useful log entry says what happened, when it happened, where it happened, and which identity or process was involved.
Monitoring is different. Monitoring is the ongoing measurement of a system so people can understand whether it is healthy. It often uses metrics, which are numbers measured over time, such as request count, memory use, error rate, and response time. A metric can tell you that errors increased; a log can often tell you which errors and why.
Detection is different again. Detection is the act of deciding that a pattern of events may be important. That pattern might be operational, such as a service beginning to fail, or security-related, such as one account trying to sign in from two distant countries within minutes. Detection is where recorded facts become a question someone should answer.
What a good log entry contains
A useful log entry is structured enough that a machine can search it and plain enough that a person can read it. Free-form text is easy to write but hard to analyze at scale. Structured logs use consistent fields, such as timestamp, service name, host, user identifier, request identifier, result, and error code.
Time matters more than it first appears. If clocks are wrong, a timeline becomes guesswork. Systems should use synchronized time and record timestamps in a consistent format. The time zone should be explicit, and high-volume systems often need millisecond or microsecond precision.
Context is the difference between a clue and a dead end. A log line that says access denied is weak. A log line that says which user, which application, which resource, which network address, and which policy caused the denial is much stronger. The goal is not to log everything; it is to log the facts you would need if the event later mattered.
- Use stable field names so searches and dashboards do not break when code changes.
- Include a request identifier or trace identifier so related events can be connected across services.
- Record the outcome, not just the attempt, because success and failure mean different things.
- Avoid secrets, passwords, access tokens, full payment card numbers, and unnecessary personal data.
- Log at the point where the system has the most accurate context, not merely at the outer edge.
Collect, normalize, and retain
Logs begin on many machines and in many formats. Applications, operating systems, cloud services, network devices, identity systems, and security tools all produce records. Collection is the process of moving those records to a place where they can be searched, protected, and compared.
Normalization means translating different records into a common shape. One product may call a user field username, another principal, and another actor. Normalization does not make those systems identical, but it lets analysts ask one question across many sources. Without it, every investigation becomes a set of custom translations.
Retention is the decision about how long to keep records. Short retention is cheaper but may fail when an incident is discovered late. Long retention helps investigations, audits, and trend analysis, but it costs money and increases the duty to protect the data. Good retention is intentional: different log types may deserve different lifetimes.
Monitoring asks whether the system is healthy
Monitoring is built on questions. Is the service available? Is it fast enough? Is it producing too many errors? Is capacity running out? These questions are often answered with metrics and shown on dashboards. A dashboard is useful when it helps a person decide what to do next, not when it merely displays many numbers.
Good monitoring focuses on user-visible health first. A server can have high central processing unit use, but users may still be fine. Another server can look quiet while every checkout request fails. Measures such as availability, latency, error rate, and throughput usually matter more than low-level resource numbers because they describe what users experience.
Monitoring also needs thresholds, but thresholds are blunt instruments. A fixed value can be right on Monday and wrong on Black Friday. Some systems need baselines, which describe normal behavior for a particular service, hour, or season. The point is to notice meaningful change, not every change.
- Availability: whether the service can be reached and used.
- Latency: how long a request takes to complete.
- Error rate: what share of requests fail.
- Throughput: how much work the system is handling.
- Saturation: how close a resource is to being exhausted.
Detection looks for meaning in behavior
Detection begins when you define behavior that should be noticed. In security, that might be a privileged account signing in from a new country, a workstation starting a suspicious process, or a large data transfer to an unusual destination. In operations, it might be a sudden rise in failed jobs or a pattern that has preceded outages before.
A detection rule is a written test for a pattern. It might be simple, such as more than ten failed sign-ins in five minutes, or more contextual, such as a successful sign-in after many failures from the same network address. Some detections use threat intelligence, which is information about known hostile infrastructure or techniques. Others use baselines to find behavior that is unusual for that environment.
Detection is never perfect. A false positive is an alert that looks important but is harmless. A false negative is a real problem that was missed. Teams improve detection by tuning rules, adding context, learning from incidents, and removing alerts that no one can act on.
Alerts must be designed for action
An alert is a request for human attention. That makes it expensive. Every alert interrupts someone, competes with other work, and may wake a person at night. An alert should therefore explain what happened, why it matters, how urgent it is, and what the first response should be.
The common failure is alert fatigue. This happens when people receive so many low-value alerts that they stop trusting them. Once that trust is lost, even good alerts are delayed or ignored. The cure is not merely better tooling. It is discipline: remove unactionable alerts, group related alerts, tune noisy rules, and measure whether alerts lead to useful outcomes.
Severity should describe impact and urgency, not emotional tone. A critical alert should mean that immediate action is required to prevent or reduce serious harm. A warning should mean attention is needed soon. An informational notification should not page anyone.
The decisions leaders and practitioners must make
Logging, monitoring, and detection involve trade-offs. Leaders decide how much visibility is worth, how much data risk is acceptable, and how quickly the organization needs to respond. Practitioners decide which events to collect, how to structure them, which alerts deserve attention, and how to prove that the system works.
Cost is one of the hardest decisions because log volume grows quickly. Keeping every debug message from every service may be unaffordable and unnecessary. Keeping too little may leave the team unable to investigate a breach, outage, or customer dispute. A practical approach is to classify log sources by value: identity, administrative activity, payment activity, network boundaries, and production errors often deserve stronger retention than routine noise.
Privacy and security are equal design concerns. Logs can contain sensitive personal data, internal architecture, session identifiers, and business secrets. Access to logs should be limited, monitored, and reviewed. Records that support accountability must also be protected from tampering, because a log that can be quietly edited is weak evidence.
The final leadership question is not whether a tool has been bought, but whether the organization can answer important questions in time. Can it tell who changed a production setting? Can it see whether customers are affected right now? Can it reconstruct an incident from last month? Can it distinguish a real attack from background noise? These are operational capabilities, not product features.
- Choose retention periods by investigative value, legal need, privacy risk, and cost.
- Protect high-value logs from deletion or alteration by the same accounts being monitored.
- Measure mean time to detect and mean time to respond, because visibility matters only if it changes outcomes.
- Fund runbooks, training, and exercises, not just storage and dashboards.
- Review alert quality regularly with the people who actually respond to alerts.
Key takeaways
- Logging records facts, monitoring watches health, and detection identifies patterns that deserve action.
- Useful logs are structured, time-consistent, contextual, and careful not to expose secrets or unnecessary personal data.
- Monitoring should begin with user-visible symptoms such as availability, latency, error rate, and throughput.
- Detection improves through a loop of hypothesis, rule writing, investigation, and tuning.
- Alerts are costly interruptions and should be clear, owned, actionable, and tied to real urgency.
- Visibility is a leadership decision as much as a technical one because it affects cost, privacy, risk, and response speed.
Glossary
- Event
- Something that happened at a specific point in time in a system, application, network, or user session.
- Log
- A recorded description of one or more events, usually including time, source, action, and outcome.
- Metric
- A numeric measurement tracked over time, such as error rate, memory use, or request count.
- Monitoring
- The continuous observation of systems to understand health, performance, and availability.
- Detection rule
- A defined test that looks for a pattern of events or measurements that may indicate a problem.
- False positive
- An alert or detection that appears important but turns out not to represent a real problem.
- False negative
- A real problem that the monitoring or detection system fails to notice.
- Baseline
- A description of normal behavior used to recognize meaningful changes or unusual activity.
- Runbook
- A practical set of instructions that tells responders what to check and do when a known alert or incident occurs.