🕵️‍♂️ Log Analysis: How to Detect Suspicious Activities — A Complete Guide


🧠 What Is Log Analysis?

Log analysis is the practice of examining and interpreting digital logs generated by operating systems, network devices, firewalls, applications, and other systems. Every action in a system — from user logins to errors — leaves a digital footprint. Studying these logs allows cybersecurity professionals to detect anomalies, threats, and system issues.

“Logs are the DNA of digital systems. They reveal the truth behind every action, good or bad.”

Log analysis is a critical part of:

  • Security Information and Event Management (SIEM)
  • Incident Detection and Response (IDR)
  • Threat Hunting
  • Compliance Auditing

Without proper log analysis, organizations may miss early signs of intrusion, configuration issues, or insider threats.


⚠️ Disclaimer

This article is for educational and ethical purposes only. It is intended to promote cybersecurity awareness and responsible defensive practices.


🔥 Why Log Analysis Is Crucial for Cybersecurity

  • 🔍 Detect brute-force and password spray attacks
  • 🕵️‍♂️ Identify insider threats
  • ❌ Spot malware activity
  • 🐍 Catch lateral movement in the network
  • ⚠️ Detect privilege escalation
  • 🧹 Uncover misconfigurations and prevent exploits
  • 🧠 Maintain system health and stability
  • 📊 Ensure compliance with regulations (e.g., GDPR, HIPAA, PCI-DSS)

📂 Key Log Types and Their Red Flags

Log TypeDescriptionSuspicious Indicators
System LogsOS events, logins, shutdownsUnusual login times, repeated failures
Authentication LogsLogin successes/failuresBrute-force patterns, unknown IPs
Firewall LogsAllowed/blocked trafficAccess to odd ports, traffic spikes
IDS/IPS LogsIntrusion alertsExploits, scans, abnormal traffic
DNS LogsDomain lookupsMalicious domain connections
Web Server LogsHTTP requests, user-agentsSQLi attempts, weird paths
VPN LogsRemote sessionsForeign access, rapid switches
Email LogsMail activitySpam floods, phishing attempts
Application LogsInternal app behaviorAbnormal usage patterns
Cloud LogsAWS/Azure/GCP eventsUnauthorized access, service manipulation

🚩 Common Indicators of Compromise (IOCs)

🔐 Authentication Anomalies

  • Multiple failed login attempts
  • Logins at 2 AM or during non-working hours
  • Successful login after failures (brute-force success)
  • Geographically impossible logins
  • Logins using disabled or inactive accounts

🌐 Network Anomalies

  • High outbound traffic volumes (data exfiltration)
  • Connection attempts to blacklisted IPs
  • DNS queries to C2 (command-and-control) servers
  • Usage of unauthorized protocols (e.g., SMB over WAN)

🏠 System Anomalies

  • Creation of new admin users
  • Disabling of security tools
  • Installation of unknown services or programs
  • Frequent restarts or crashes

🔍 File & Process Anomalies

  • Use of PowerShell, netcat, mimikatz, nmap
  • Unauthorized file access
  • Unusual file modifications
  • Sudden changes in file ownership or permissions

🛠️ Top Log Analysis Tools (2025 Edition)

Open-Source

  • ELK Stack (Elasticsearch, Logstash, Kibana): Centralized log ingestion and analysis
  • Wazuh: SIEM framework with rule-based detection
  • Graylog: Real-time analysis and dashboards
  • GoAccess: Lightweight web log analyzer (CLI-based)
  • OSSEC: Host-based intrusion detection system with log collection
  • Falco: Runtime security tool for Kubernetes log monitoring

Enterprise & Cloud

  • Splunk: Industry leader in SIEM and log analysis
  • Microsoft Sentinel: Cloud-native SIEM for Azure
  • IBM QRadar: Enterprise-grade threat detection
  • LogRhythm: Full-stack security intelligence platform
  • Rapid7 InsightIDR: Cloud SIEM with UEBA features
  • Sumo Logic: Cloud-native analytics with built-in machine learning

🔎 Real-World Example: SSH Brute-Force Attack

Sample SSH Log Entries (Brute-Force)

━━━━━━━━━━━━━━━━━━━━━━━ Jun 24 12:32:10 server sshd[1521]: Failed password for root from 185.225.19.40 port 50233 ssh2
Jun 24 12:32:11 server sshd[1523]: Failed password for root from 185.225.19.40 port 50233 ssh2
Jun 24 12:32:12 server sshd[1525]: Failed password for root from 185.225.19.40 port 50233 ssh2
Jun 24 12:32:13 server sshd[1526]: Accepted password for root from 185.225.19.40 port 50233 ssh2
━━━━━━━━━━━━━━━━━━━━━━━

🚩 Detection

  • Multiple failures followed by a success
  • Suspicious IP address
  • Unusual time of login

🏰 Response

  • Block the IP in the firewall (e.g., iptables)
  • Search logs for lateral movement
  • Verify no privilege escalation or new accounts were created
  • Notify SOC (Security Operations Center) and begin incident response

🧠 Techniques for Effective Log Analysis

  • Regex Matching: Search for repeated failures or patterns
  • Time Correlation: Group events by timeframes (e.g., 20 logins/min)
  • Geo-IP Lookup: Map IPs to locations
  • Behavioral Baselines: Detect when user behavior changes drastically
  • Machine Learning (Optional): Use anomaly detection models
  • Log Normalization: Convert logs to a standard format for comparison
  • Threat Intelligence Feeds: Integrate blacklists, IOC lists for better context

✅ Mapping to MITRE ATT&CK (TTP Detection)

MITRE CodeTechniqueRelated LogsExample Entry or Command
T1110Brute ForceAuth LogsFailed password for root from 192.168.1.101 port 34567
T1071Application Layer Protocol AbuseDNS, HTTP LogsDNS query to malicious domain
T1059Command and Scripting InterpreterProcess Logspowershell.exe -EncodedCommand ...
T1087Account DiscoveryLDAP, AD Logswhoami, net user, Get-ADUser
T1566PhishingEmail LogsEmail with spoofed sender and suspicious attachment
T1027Obfuscated Files or InformationScript LogsBase64-encoded PowerShell command in a startup script
T1204User ExecutionWeb, Email, App Logs.exe downloaded from phishing link, followed by install

📜 Best Practices Checklist

  • ✅ Centralize all logs (ELK, Wazuh, Graylog)
  • ✅ Configure alerts for high-risk patterns
  • ✅ Retain logs for 90–180 days minimum
  • ✅ Encrypt and restrict log file access
  • ✅ Review detection rules regularly
  • ✅ Automate where possible, but manually review critical logs
  • ✅ Include logs in business continuity and disaster recovery plans
  • ✅ Document log sources and review coverage regularly

📚 Glossary for Beginners

  • SIEM: Security Information and Event Management platform
  • Regex: Rule syntax to search patterns in text
  • Brute Force: Repeated password-guessing attacks
  • Lateral Movement: Hacker moving through internal systems
  • C2 Server: Command & Control server used by malware
  • UEBA: User and Entity Behavior Analytics
  • Syslog: Standard protocol for system log messages

❓ FAQ: Log Analysis for Beginners

What is the first log I should analyze on Linux?
Start with /var/log/auth.log and /var/log/syslog. These show login and system events.

What if I find a suspicious IP?
Search the IP in VirusTotal or AbuseIPDB. Block it and investigate further.

Are free tools enough?
Yes. Open-source tools like ELK or Wazuh can rival paid solutions if configured well.

What’s the hardest part of log analysis?
Correlating events across systems and filtering false positives.

How often should I check logs?
Critical infrastructure: daily. Others: weekly or automated with alerts.

Can I use AI for log analysis?
Yes. Many SIEM platforms now integrate ML models to flag anomalies and unknown threats.

What is log rotation?
Log rotation ensures old logs are archived or deleted to save space and avoid overflow.


🏁 Conclusion

Log analysis turns raw data into actionable security insights. By learning what to look for and using the right tools, you can detect threats early and stop them in their tracks.

🔒 Be proactive. Be vigilant. And always check your logs.

Leave a Comment