Ravindra BagaleCourses & study guides मराठी Track your progress

31. SOC, SIEM and Incident Response

31.2 Where Logs Live

Logs are the raw evidence. Know where each one is:

Source Location / how to read What it shows
Linux authentication (Amazon Linux/RHEL) /var/log/secure SSH logins, sudo use, failed passwords
Linux authentication (Ubuntu/Kali) /var/log/auth.log Same as above
Linux system /var/log/messages, journalctl Services, kernel, errors
Apache /​var/​log/​httpd/​access_​log, error_log Every web request, status codes, errors
Nginx /​var/​log/​nginx/​access.​log, error.log Same for Nginx
MySQL /​var/​log/​mysqld.​log Failed DB logins, errors
Windows Event Viewer, Security log Logon events: 4624 success, 4625 failure, 4720 user created
AWS CloudTrail, VPC Flow Logs, S3/ELB access logs (Chapter 30) API calls, network traffic

Quick investigation commands you already know, now used like an analyst:

# Failed SSH logins and the top attacking IPs
sudo grep "Failed password" /var/log/secure | awk '{print $(NF-3)}' | sort | uniq -c | sort -nr | head
# Successful logins – did any attacker get in?
sudo grep "Accepted" /var/log/secure
# Who used sudo?
sudo grep "sudo:" /var/log/secure | tail
# Web attacks: SQLi/XSS patterns and 404 floods in Apache
sudo grep -Ei "union|select|<script|\.\./" /var/log/httpd/access_log | tail
sudo awk '$9==404 {print $1}' /var/log/httpd/access_log | sort | uniq -c | sort -nr | head

Ravindra Bagale's Tip

Don't panic when you see "Failed password" – every server on the internet gets thousands of attempts every day. The real worry is when "Accepted" appears from the same IP after the "Failed" ones – that means the password was guessed. Always look for a success after failures.

Lab

From Kali run a short Hydra attack (Chapter 22) against the Metasploitable SSH service, then log in once successfully with the right password. On Metasploitable read /var/log/auth.log and find: the Kali IP, how many failures, and the time of the successful login. Then run a Nikto scan (Chapter 20) against DVWA and find its traces in the Apache access log.

Extended teaching notes

Why this lesson matters

A SOC turns logs into action. Good juniors triage with playbooks: what fired, which asset, how bad, contain or escalate, write the timeline.

  1. Prepare: asset list, contacts, runbooks.
  2. Detect: SIEM/EDR alerts with context.
  3. Contain: disable account, isolate host, block IOC.
  4. Eradicate & recover: patch, rebuild, restore.
  5. Lessons: one improvement ticket per incident.

Indian company (sample)

A 24×7 SOC at a large Indian IT services firm handles phishing and malware for many clients. Tier-1 analysts follow a script; they do not freestyle on production.

Mini case study

Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.

Defender's worksheet (do this today)

  1. Write the lesson title, date and the exact lab target you are allowed to use.
  2. List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
  3. Run one safe check from the lesson on a lab system only. Paste the command and output.
  4. Write a two-sentence fix you would give a teammate.
  5. Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.

Indian workplace (sample data)

Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).

Global practice

Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.

Everyday analogy

Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.

Key terms

  • Control: a safeguard (patch, config, process, detection).
  • Finding: a weakness backed by evidence.
  • Remediation: the fix plus how you verified it.
  • Scope: systems you have written permission to touch.
  • Least privilege: only the access the task needs.
  • Defence in depth: several layers so one failure does not end the story.

Common mistakes

  • Skipping written permission "just for a quick scan".
  • Practising on hostel, office or public targets without authorisation.
  • Collecting tool output without writing the fix.
  • Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
  • Publishing screenshots that contain secrets, cookies or internal hostnames.

Recap

  • Evidence, fix, owner, date.
  • Own lab only.
  • Fix > spectacle.