Lion Cipher Lab

Detect anomalies in logs with Python

Why it matters

Counting failed logins is useful; knowing which count is abnormal is where detection begins. Analysts drown in logs precisely because everything looks the same at a glance — thousands of lines, all a little noisy. A tiny bit of statistics turns that noise into a question a computer can answer: given what normal looks like, which values stick out? That single move — describe normal with a mean and a spread, then flag departures from it — is the foundation under a huge amount of real security tooling, from simple alert rules to full machine-learning anomaly detection. Learning it by hand, on…

What you'll learn

Steps in this lab

  1. The idea: let statistics point at what does not fit
  2. Make a sample login log to practise on
  3. Count the failed logins per IP
  4. Describe normal with two numbers: mean and standard deviation
  5. The 3-sigma rule: draw the line for unusual
  6. Put it together: the anomaly flagger
  7. The honest limits: unusual is not the same as malicious
  8. Where this grows up: the seed of ML anomaly detection
  9. What you just proved

Open the full interactive lab →