FixTheVuln

Log Analysis Cheat Sheet

By FixTheVuln Team Peer-reviewed security content Sources: CISA, NVD, OWASP

Test Your Knowledge

CySA+ Practice Quiz Security+ Practice Quiz
← Back to Home

Key Takeaways

Security Log Analysis Reference

Log analysis is a fundamental skill for security analysts, incident responders, and threat hunters. Knowing which logs to check, what events to look for, and how to quickly extract meaningful patterns separates effective analysts from those overwhelmed by data. This cheat sheet provides quick-reference tables for Windows Event IDs, Linux log locations, command-line analysis techniques, and event correlation patterns you will use daily.

Windows Security Event IDs

These Event IDs from the Windows Security event log are the most commonly analyzed during security investigations. All IDs are from the Microsoft Windows Security Auditing provider.

Event ID Event Category Security Relevance
4624Successful logonLogon/LogoffTrack who logged in, when, from where, and logon type (2=interactive, 3=network, 10=RDP)
4625Failed logonLogon/LogoffBrute force detection, credential stuffing, account lockout investigation
4634LogoffLogon/LogoffSession duration analysis, correlate with 4624 for full session timeline
4648Logon with explicit credentialsLogon/LogoffRunAs usage, lateral movement with alternate credentials
4672Special privileges assignedPrivilege UseAdmin logon detection, privilege escalation monitoring
4688New process createdProcess TrackingCommand execution tracking (enable command-line logging for full value)
4689Process exitedProcess TrackingProcess lifetime analysis, correlate with 4688
4698Scheduled task createdObject AccessPersistence mechanism detection — attackers frequently use scheduled tasks
4720User account createdAccount MgmtUnauthorized account creation, backdoor account detection
4722User account enabledAccount MgmtRe-enabled dormant or disabled accounts
4724Password reset attemptAccount MgmtUnauthorized password changes, account takeover
4732Member added to security groupAccount MgmtPrivilege escalation — user added to Administrators, Domain Admins, etc.
4738User account changedAccount MgmtAccount modification tracking, attribute changes
4776NTLM authentication attemptAccount LogonNTLM relay attacks, legacy authentication monitoring
7045New service installedSystemPersistence and privilege escalation via service creation (System log, not Security)
1102Audit log clearedSystemAnti-forensics — attacker clearing their tracks (always investigate immediately)

Note: Windows logon types in Event 4624: Type 2 (Interactive/console), Type 3 (Network/SMB), Type 4 (Batch), Type 5 (Service), Type 7 (Unlock), Type 10 (RemoteInteractive/RDP), Type 11 (CachedInteractive).

Linux Log Locations

Log File Distro Contents Security Use
/var/log/auth.logDebian/UbuntuAuthentication events: SSH, sudo, PAMFailed logins, brute force, privilege escalation
/var/log/secureRHEL/CentOSAuthentication events: SSH, sudo, PAMSame as auth.log for RHEL-based systems
/var/log/syslogDebian/UbuntuGeneral system messagesService start/stop, cron execution, system errors
/var/log/messagesRHEL/CentOSGeneral system messagesSame as syslog for RHEL-based systems
/var/log/audit/audit.logAll (with auditd)Kernel-level audit eventsFile access, syscalls, SELinux denials, user actions
/var/log/kern.logDebian/UbuntuKernel messagesHardware errors, kernel exploits, module loading
/var/log/cronRHEL/CentOSCron job executionScheduled task abuse, persistence mechanisms
/var/log/apache2/access.logDebian/UbuntuWeb server access logsWeb attacks, SQLi attempts, directory traversal
/var/log/httpd/access_logRHEL/CentOSWeb server access logsSame as above for RHEL-based systems
/var/log/faillogAllFailed login attemptsBrute force tracking (use faillog command to read)
/var/log/lastlogAllLast login per userDetect dormant account usage (use lastlog command)

Bash Commands for Log Analysis

# --- Authentication Analysis ---

# Count failed SSH logins by source IP (Debian/Ubuntu)
grep "Failed password" /var/log/auth.log \
  | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -20

# Count failed SSH logins by source IP (RHEL/CentOS)
grep "Failed password" /var/log/secure \
  | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -20

# Show successful SSH logins with timestamps
grep "Accepted" /var/log/auth.log \
  | awk '{print $1, $2, $3, $9, $11}' | tail -50

# Find sudo commands executed
grep "COMMAND=" /var/log/auth.log \
  | awk -F'COMMAND=' '{print $2}' | sort | uniq -c | sort -rn

# --- Web Server Analysis ---

# Top 20 requesting IPs
awk '{print $1}' /var/log/apache2/access.log \
  | sort | uniq -c | sort -rn | head -20

# Find potential SQL injection attempts
grep -iE "(union.*select|or.*1.*=.*1|drop.*table|insert.*into)" \
  /var/log/apache2/access.log

# Find directory traversal attempts
grep -E "\.\./\.\." /var/log/apache2/access.log

# HTTP status code distribution
awk '{print $9}' /var/log/apache2/access.log \
  | sort | uniq -c | sort -rn

# --- Timeline Analysis ---

# Extract events in a specific time window
awk '$0 >= "Mar  6 14:00" && $0 <= "Mar  6 15:00"' /var/log/auth.log

# Count events per minute (for spike detection)
awk '{print $1, $2, $3}' /var/log/auth.log \
  | cut -d: -f1,2 | sort | uniq -c | sort -rn | head -20

# --- JSON Log Analysis with jq ---

# Parse JSON logs (e.g., cloud audit trails)
cat audit.json | jq -r '.events[] | [.timestamp, .user, .action, .resource] | @tsv'

# Filter specific actions
cat audit.json | jq '.events[] | select(.action == "DeleteBucket")'

Correlation Patterns

Individual log events tell a limited story. The real power of log analysis comes from correlating events across multiple sources to reconstruct attack narratives.

Pattern Events to Correlate Indicates
Brute Force → Success Multiple 4625 (failed) from same IP followed by 4624 (success) for same account Successful password attack — immediate investigation needed
Lateral Movement 4624 Type 3 (network logon) from internal IP + 4688 (process creation) on target host Attacker moving between systems using compromised credentials
Privilege Escalation 4732 (added to admin group) or 4672 (special privileges) shortly after 4624 Account gaining elevated access — verify authorization
Persistence Installation 4698 (scheduled task) or 7045 (new service) created by non-admin or from unusual path Attacker establishing persistence mechanism
Data Exfiltration Large outbound transfers (proxy logs) + DNS TXT queries (DNS logs) from same host Data being exfiltrated via web or DNS channels
Anti-Forensics 1102 (log cleared) + 4688 showing wevtutil or Clear-EventLog commands Attacker destroying evidence — treat as confirmed compromise

Log Analysis Workflow

Step Action Tools/Techniques
1. Scope Define the time window, systems, and users of interest Incident ticket, alert context, threat intelligence
2. Collect Gather relevant logs from all applicable sources SIEM queries, log forwarding, direct access
3. Normalize Ensure consistent timestamps (UTC), field names, and formats Log parsing, timestamp conversion, field mapping
4. Filter Remove noise — known-good events, scheduled tasks, monitoring systems grep -v, allowlists, SIEM filters
5. Analyze Look for anomalies, known-bad indicators, and suspicious patterns Pattern matching, statistical analysis, IOC searches
6. Correlate Link events across sources to build a timeline and narrative Timeline tools, SIEM correlation, manual pivoting
7. Document Record findings, IOCs, affected systems, and recommended actions Investigation notes, IOC lists, timeline artifacts

Explore More Blue Team Guides

For comprehensive tutorials and security guides:

Visit FixTheVuln.com →

Related Resources

📝 SIEM Rule Writing Guide Build detection rules from log patterns 🎯 Threat Hunting for Beginners Use logs proactively to find hidden threats 🚨 Incident Response Guide Log analysis during incident investigations

FixTheVuln Store

Get the CompTIA CySA+ Study Planner

Fillable PDF study planners with domain trackers, weekly schedules, and progress tracking. Available in Standard, ADHD-Friendly, Dark Mode, and 4-Format Bundle.

CompTIA CySA+ Planner

60+ certifications available — from $5.99

FixTheVuln Store

Patch Tuesday Sprint Kit

5 fillable templates for vulnerability triage, sprint planning, testing, SLA tracking, and executive reporting. Free blank templates or $4.99/mo for pre-filled intelligence with real CISA KEV data.

Try Free Templates Subscribe — $4.99/mo

CyberFolio

Choosing your next cert? Track them all in one place.

Build a shareable cybersecurity portfolio that highlights your certifications, projects, and skills — free.

Build Your Portfolio →