SOC Log Analyzer Back to Dashboard
Security Technical Writeup

SOC Log Analyzer
Threat Detection Engine

A comprehensive security analysis tool built to detect, classify, and escalate threats across SSH authentication logs, Apache web server logs, and Windows Event logs in real time.

Version 1.0.029 Detection Rules3 Log Formats89 TestsZero Dependencies

SOC Log Analyzer is a pure Python security tool designed for Security Operations Center analysts to rapidly triage log files and surface active threats. The tool processes raw log data from multiple sources and applies a rule-based detection engine to identify attack patterns including brute-force attempts, injection attacks, privilege escalation, and post-exploitation activity.

Design PhilosophyZero external dependencies. The entire tool runs on Python standard library, making it deployable on any system without package conflicts or installation issues.
CRITICAL Detection
HIGH Severity Rules
MEDIUM Indicators
Zero Dependencies
CI/CD Ready

The system is built as a pipeline with five stages. Each stage has a single responsibility and passes structured data to the next.

Detection Pipeline Log File parser.py # Auto-detect format, parse to dicts rules.py # Apply 29 rules, produce SecurityEvents geoip.py # Enrich IPs with country/city (optional) alerting.py # POST to Slack/webhook (optional) formatters.py # pretty / JSON / CSV / Markdown output

parser.py — Log Ingestion

Handles three distinct log formats through auto-detection. Peeks at the first 20 lines to classify the format, then runs the appropriate parser. Each parser extracts structured fields while tolerating malformed lines.

rules.py — Detection Engine

Each of the 29 rule functions receives a record dictionary and returns either a SecurityEvent or None. Rules are pure functions with no side effects, making them independently testable. After all rules fire, a brute-force escalation pass promotes events from HIGH to CRITICAL when a source IP exceeds the hit threshold.

watcher.py — Live Tail Engine

Uses stdlib polling for cross-platform compatibility. Detects log rotation by monitoring file inodes — when the inode changes the watcher reopens the file automatically without losing any lines.

SSH Authentication Threats

Rule IDDescriptionMITRE TacticSeverity
ssh_failed_loginFailed password authenticationCredential AccessHIGH
ssh_invalid_userLogin attempt for non-existent userReconnaissanceHIGH
ssh_root_loginAuthentication attempt as rootPrivilege EscalationHIGH
ssh_accepted_passwordSuccessful password authenticationInitial AccessLOW
sudo_to_rootSudo privilege escalation to rootPrivilege EscalationHIGH
ssh_repeated_failuresSyslog repeated failure patternBrute ForceCRITICAL

Web Application Threats

Rule IDDescriptionMITRE TacticSeverity
web_lfi_passwd/etc/passwd in request pathCredential AccessCRITICAL
web_path_traversalDirectory traversal patternDiscoveryCRITICAL
web_sqliSQL injection payload in URLCollectionCRITICAL
web_xssCross-site scripting payloadExecutionCRITICAL
web_scannerKnown scanner User-Agent (nikto, sqlmap)ReconnaissanceHIGH
web_shell_cmdWebshell command execution parameterExecutionCRITICAL
web_log4jLog4Shell CVE-2021-44228 exploitInitial AccessCRITICAL
web_admin_scanAdmin panel probing (401/403/404)ReconnaissanceMEDIUM

Windows Event Log Threats

Rule IDEvent IDDescriptionSeverity
win_failed_logon4625Failed Windows logon attemptHIGH
win_account_lockout4740Account locked out after failuresHIGH
win_net_user_add4688New local user via net user /addCRITICAL
win_add_to_admins4688User added to Administrators groupCRITICAL
win_ps_encoded4688Encoded PowerShell (-EncodedCommand)HIGH
win_registry_change4657Registry Run key modified (persistence)CRITICAL
win_log_cleared1102Security event log clearedCRITICAL
win_wmi_exec4688WMI remote process executionHIGH

Scenario 1 — SSH Brute Force to Root Access

02:14:01
Brute force begins
185.220.101.45 sends rapid failed password attempts against root. Rule: ssh_failed_login at HIGH.
02:14:07
Escalation triggered
After 8 failures from same IP, brute-force escalation promotes all events to CRITICAL.
05:30:00
Successful root login
203.0.113.99 achieves successful password login as root.
Analyst Action RequiredBlock 185.220.101.45 at firewall immediately. Audit all commands run by root after 05:30. Check for new cron jobs, SSH authorized_keys modifications, and new user accounts.

Scenario 2 — Windows Privilege Escalation and Persistence

01:05:00
Credential brute force
185.220.101.45 attempts 6 rapid failed logons against administrator (Event 4625).
01:10:00
Account lockout
Administrator locked out (Event 4740). Brute force escalated to CRITICAL.
01:15:00
Backdoor account created
net user hacker /add and net localgroup administrators hacker /add executed.
01:16:00
Registry persistence
HKCU Run key modified to execute svchost32.exe on every login (Event 4657).
01:18:00
Log cleared — cover-up
Security event log cleared by CORP\hacker (Event 1102).
Incident Response RequiredIsolate CORP-PC-01 immediately. Attacker has SYSTEM-level persistence via registry Run key, a backdoor admin account, and has cleared the security log.

89 tests across 12 test classes, all passing on Python 3.10, 3.11, and 3.12 in CI.

TestDetectLogType
Auto-detection of SSH, Apache, Windows formats
TestSSHParser
Field extraction, IP parsing, timestamp parsing
TestApacheParser
Combined log format, status codes, User-Agent
TestWindowsParser
CSV parsing, Event ID extraction, timestamps
TestSSHRules
All 7 SSH detection rules with escalation
TestApacheRules
All 11 web attack rules including Log4Shell
TestWindowsRules
All 9 Windows Event rules
TestBruteForce
Threshold escalation at 5 and 100 hits
TestFormatters
Pretty, JSON, CSV, Markdown validation
TestWatcher
File tailing, rotation detection
TestGeoIP
Private IP detection, caching, public lookup
TestAlerting
Slack payload, webhook, failure handling

Command Line

soc-analyzer auth.log soc-analyzer auth.log apache.log windows.csv soc-analyzer auth.log -s CRITICAL soc-analyzer auth.log -f json -o report.json soc-analyzer /var/log/auth.log --watch --alert-webhook https://hooks.slack.com/... soc-analyzer apache.log --geo
Live ApplicationThe web dashboard is live at https://soc-log-analyzer-ejpx.onrender.com

Supported Formats