4.1 Log Fundamentals, Sources, and Host Logging
Key Takeaways
- Logs provide essential—but potentially incomplete or altered—telemetry for detection, investigation, and compliance; analysts must validate source coverage, time, integrity, and retention.
- Windows Security Event IDs 4624 (with logon types 2, 3, 7, and 10), 4625, 4672, 4688 (with command-line auditing), and 7045 represent core telemetry for tracking authentication, privilege assignment, process execution, and service installation.
- Microsoft Sysmon operates via a kernel-mode driver (sysmon.sys) and user-mode service, capturing high-fidelity behavioral artifacts including Process Creation (EID 1), Network Connections (EID 3), CreateRemoteThread (EID 8), ProcessAccess to LSASS (EID 10), and DNSEvent (EID 22).
- Linux systems log authentication and system events within /var/log/auth.log (or /var/log/secure), while wtmp, btmp, and lastlog provide binary session histories accessible via the last, lastb, and lastlog utilities.
- Linux combines kernel-generated audit records with user-space auditd collection, while macOS unified logging is queried with the log utility by process, subsystem, category, message, and time window.
The Role of Logs in Security Operations
In modern Security Operations Centers (SOCs), logs are recorded representations of selected activity across endpoints, networks, cloud workloads, and applications. They are indispensable, but they are not infallible ground truth: a source can be disabled, filtered, delayed, overwritten, forged, or collected with the wrong time settings. Analysts therefore validate coverage, timestamps, integrity, and corroboration before drawing a conclusion.
Logs serve three primary operational functions in a SOC:
- Real-Time Detection & Alerting: Security Information and Event Management (SIEM) systems ingest streaming event data to evaluate correlation rules and trigger immediate investigations upon detecting anomalous patterns (e.g., ten consecutive failed logons followed by a successful logon within thirty seconds).
- Forensic Incident Reconstruction: When an intrusion is confirmed, incident response (IR) teams interrogate historical logs to determine initial access vectors, dwell time, lateral movement paths, and data exfiltration scope.
- Compliance Evidence: Applicable contracts, laws, and standards can require particular audit controls, review frequencies, protections, and retention periods. PCI DSS, the HIPAA Security Rule, and Sarbanes-Oxley-related control programs differ; none should be summarized as one universal “continuous tamper-proof logging” mandate.
Enterprise Log Classification Taxonomy
To manage high-volume ingestion pipelines, SOC architectures categorize log data by functional origin:
| Log Classification | Primary Generating Sources | Core Telemetry Captured | Key SOC Detection Value |
|---|---|---|---|
| System Logs | Operating system kernels, device drivers, physical hardware | Boot events, hardware failures, driver loading, system shutdowns | Rootkits, hardware tampering, unexpected reboots, kernel panics |
| Security Logs | OS authentication subsystems, Active Directory, PAM | User logons, privilege assignments, credential validations, audit policy modifications | Brute force, pass-the-hash, privilege escalation, unauthorized account creation |
| Application Logs | Web servers, enterprise ERPs, line-of-business software | Application errors, API requests, user transactions, stack traces | Application-layer exploits, unauthorized transaction manipulation, SQL injection |
| Network Logs | Firewalls, routers, switches, proxies, DNS/DHCP servers | 5-tuple flow records, NAT translations, packet drops, DNS resolution queries | Command-and-control beaconing, DNS tunneling, network reconnaissance, data staging |
| Database Logs | RDBMS engines (MS SQL, Oracle, PostgreSQL, MySQL) | DDL schema alterations, DML record modifications, query execution, failed DB logins | Unauthorized database dumps, permission grants (sp_addsrvrolemember), data tampering |
| Cloud & Identity Logs | Cloud Control Planes (AWS CloudTrail, Azure Activity, MS Graph) | API invocations, role assignments, conditional access evaluations, token grants | Cloud privilege escalation, cross-tenant lateral movement, anonymous token reuse |
Windows Host Event Logging Architecture
Microsoft Windows generates operational telemetry through the Windows Event Log subsystem, writing structured XML records to binary EVTX files located in %SystemRoot%\System32\Winevt\Logs\. The Windows Event Log service (eventlog.dll), hosted inside svchost.exe, manages log writes, channel routing, and access controls.
Windows organizes events into distinct Channels:
- Administrative Channels: High-value events intended for IT administrators and security analysts (e.g.,
System.evtx,Security.evtx). - Operational Channels: Highly detailed runtime events capturing subsystem operational transitions (e.g.,
Microsoft-Windows-TaskScheduler/Operational.evtx,Microsoft-Windows-TerminalServices-LocalSessionManager/Operational.evtx). - Analytic and Debug Channels: High-volume diagnostic events disabled by default due to storage overhead; written directly as event trace log (
.etl) files.
Host security analysis relies heavily on the Security Log (Security.evtx) and the System Log (System.evtx).
Critical Windows Security Event IDs
1. Event ID 4624: Successful Account Logon
Event ID 4624 documents every successful authentication. Analyzing the Logon Type field is vital for distinguishing legitimate human actions from adversary automation, service persistence, and lateral movement:
| Logon Type | Classification | Technical Operational Context | SOC Analytical Significance |
|---|---|---|---|
| Type 2 | Interactive | Direct physical console logon using local keyboard, mouse, and display. | Normal desktop access; abnormal on headless data center servers. |
| Type 3 | Network | Access via SMB network shares, RPC, or Kerberos network tickets (e.g., net use, PsExec, or WMI connection). | Primary indicator of adversary lateral movement and remote file execution. |
| Type 4 | Batch | Execution of scheduled tasks or batch automation jobs. | Scheduled task execution, persistence scripts, maintenance jobs. |
| Type 5 | Service | Startup of a background service running under a designated service account. | Service initialization; rogue service execution. |
| Type 7 | Unlock | Workstation screen unlocked by an authenticated user entering credentials. | Confirms physical or active user presence at an endpoint. |
| Type 8 | NetworkCleartext | Logon where credentials were sent across the network in plaintext (e.g., basic IIS authentication). | Weak protocol usage; risk of credential eavesdropping. |
| Type 9 | NewCredentials | Caller cloned its current token and specified new outbound credentials (e.g., runas /netonly). | Mimikatz pass-the-hash or credential impersonation tool execution. |
| Type 10 | RemoteInteractive | Remote Desktop Protocol (RDP) session initiation, Terminal Services, or Remote Assistance. | Remote administrative sessions; unauthorized interactive lateral access. |
| Type 11 | CachedInteractive | Logon using cached domain credentials when domain controllers are unreachable. | Off-network mobile laptop logons; potential cached credential abuse. |
2. Event ID 4625: An Account Failed to Log On
Indicates an authentication rejection. SOC analysts evaluate the Status and Sub Status hex codes to isolate specific attack types:
0xC000006A: Bad password entered with a valid username (common in brute-force and password-spraying attacks).0xC000006D: Generic logon failure; the username or authentication information is incorrect. Use the sub-status and surrounding events to distinguish an unknown account from a bad password.0xC0000064: The user account does not exist within the authenticating domain/system.0xC0000072: The user account is currently disabled.0xC0000234: Account locked out due to exceeding the configured account lockout threshold.0xC000006E: Account logon time restriction violation.
3. Event ID 4672: Special Privileges Assigned to New Logon
Generated immediately after Event ID 4624 when an authenticated account possesses administrative or high-value rights. Sensitive privileges to monitor include:
SeDebugPrivilege: Enables process memory inspection and debugging; required by credential-dumping tools to extract hashes fromlsass.exe.SeTcbPrivilege: Act as part of the operating system; grants full operating system identity.SeImpersonatePrivilege/SeAssignPrimaryTokenPrivilege: Token impersonation and process creation under alternate security contexts (abused in Potato-style local privilege escalation exploits).SeBackupPrivilege/SeRestorePrivilege: Allows reading/writing any file on disk regardless of NTFS permissions (abused to stealNTDS.ditor SAM hives).
4. Event ID 4688: A New Process Has Been Created
Essential for process tree analysis. By default, Windows does not capture command-line strings. Administrators must enable Include command line in process creation events via Group Policy (Computer Configuration > Administrative Templates > System > Audit Process Creation). The resulting telemetry captures the Creator Process ID (parent), New Process ID (child), Process Name, CommandLine parameters (e.g., detecting obfuscated PowerShell commands with -enc), and Token Elevation Type.
5. Additional Key Windows Event IDs
- Event ID 4720: User Account Created (tracks rogue account provisioning).
- Event ID 4722: User Account Enabled (tracks reactivation of dormant administrative accounts).
- Event ID 4724: An attempt was made to reset an account's password.
- Event ID 4726: User Account Deleted.
- Event IDs 4728, 4732, 4756: Member added to Global, Local (e.g., local Administrators), or Universal security groups.
- Event ID 7045 (System Log): A new service was installed on the system (identifies persistence, PsExec service execution, and rootkits). Captures Service Name, Service File Name (
ImagePath/binPath), and Service Type. - Event ID 4697 (Security Log): A service was installed in the system (Security channel equivalent of 7045).
- Event ID 1102 (Security Log) / Event ID 104 (System Log): The audit log was cleared (strong indicator of anti-forensic activity; generated even if an attacker purges all other records).
Microsoft Sysmon (System Monitor)
While native Windows Security auditing captures basic events, Microsoft Sysmon (part of Sysinternals) provides deep, kernel-level behavioral telemetry. Sysmon installs as a kernel device driver (sysmon.sys) and a user-mode service (sysmon.exe), writing directly to Microsoft-Windows-Sysmon/Operational in EVTX format.
<!-- Sample Sysmon XML Configuration Filter -->
<Sysmon schemaversion="4.90">
<HashAlgorithms>SHA256,IMPHASH</HashAlgorithms>
<EventFiltering>
<!-- Event ID 1: Process Creation - Include suspicious parent/child patterns -->
<RuleGroup name="ProcessCreation" groupRelation="or">
<ProcessCreate onmatch="include">
<Image condition="end with">powershell.exe</Image>
<Image condition="end with">cmd.exe</Image>
<ParentImage condition="end with">w3wp.exe</ParentImage>
</ProcessCreate>
</RuleGroup>
<!-- Event ID 10: ProcessAccess - Monitor attempts to open LSASS memory -->
<RuleGroup name="LsassAccess" groupRelation="or">
<ProcessAccess onmatch="include">
<TargetImage condition="end with">lsass.exe</TargetImage>
<GrantedAccess condition="is">0x1010</GrantedAccess>
</ProcessAccess>
</RuleGroup>
</EventFiltering>
</Sysmon>
Key Sysmon Event IDs
- Event ID 1 (Process Creation): Logs full process launch details, parent process command lines, user context, and cryptographic image hashes (SHA256, MD5, IMPHASH).
- Event ID 3 (Network Connection): Maps outbound/inbound TCP/UDP connections directly to the originating Process ID, executable path, source/destination IP, and port numbers.
- Event ID 5 (Process Terminated): Logs when a process stops executing, capturing Process ID and executable image name.
- Event ID 7 (Image Loaded): Tracks module/DLL loading within processes. Critical for detecting DLL sideloading and DLL search order hijacking; records digital signature verification status.
- Event ID 8 (CreateRemoteThread): Detects process injection techniques where an adversary creates an execution thread inside a remote process (e.g., injecting shellcode into
svchost.exeorexplorer.exe). - Event ID 10 (ProcessAccess): Records when one process opens a handle to another via
OpenProcess. Monitors credential theft attempts against the Local Security Authority Subsystem Service (lsass.exe) with access masks such as0x1010(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ) or0x1F0FFF(PROCESS_ALL_ACCESS). - Event ID 11 (FileCreate): Logs file system creation events, capturing ransomware ransom notes and dropped executable payloads.
- Event IDs 12, 13, 14 (Registry Events): Capture registry object creation/deletion (12), value modification (13), and renaming (14). Primary detection source for Run/RunOnce persistence keys and Image File Execution Options (IFEO) hijacking.
- Event ID 22 (DNSEvent): Records DNS queries initiated by individual processes, capturing the query name, query status, and returned IP results.
Windows Security Event IDs vs. Sysmon Event IDs
| Detection Capability | Windows Security Event ID | Sysmon Event ID | Forensic / Detection Value |
|---|---|---|---|
| Process Creation | 4688 (requires GPO enablement) | 1 (enabled by default) | Sysmon adds ParentCommandLine, file hashes (SHA256, IMPHASH), and logon GUIDs. |
| Process Injection | Not available natively | 8 (CreateRemoteThread) | Identifies thread injection into legitimate processes to hide malicious memory execution. |
| LSASS Memory Dumping | 4656 / 4663 (voluminous object access) | 10 (ProcessAccess) | Provides precise GrantedAccess masks and CallTrace data targeting lsass.exe. |
| Network Connection by Binary | 5156 (Windows Filtering Platform) | 3 (Network Connection) | Sysmon correlates the socket connection directly to executable path and process GUID. |
| DLL / Image Loading | Not natively auditable | 7 (Image Loaded) | Captures DLL sideloading, unmanaged code execution, and unverified binary loads. |
| Process-Level DNS Queries | Not available in Security Log | 22 (DNSEvent) | Traces command-and-control domain lookups directly back to the offending executable binary. |
Linux and Unix Host Telemetry
Linux and Unix operating systems write human-readable and binary logs to /var/log. The logging subsystem is traditionally managed by rsyslog or systemd-journald.
Standard Linux Log Directory Structure
| Log File Path | Operating System Family | Description and Forensic Content |
|---|---|---|
/var/log/auth.log | Debian, Ubuntu | User authentication logs, SSH sessions, sudo execution, Pluggable Authentication Module (PAM) records. |
/var/log/secure | Red Hat, CentOS, Fedora, Rocky | Equivalent to auth.log; records authentication attempts, failed root logins, and user privilege changes. |
/var/log/syslog | Debian, Ubuntu | Central system message log capturing kernel, daemon, and non-authentication application events. |
/var/log/messages | Red Hat, CentOS, SUSE | Equivalent to syslog; general operating system messages and daemon runtime telemetry. |
/var/log/cron | Red Hat, CentOS, SUSE | Records scheduled cron job execution, user scripts, and scheduled maintenance tasks. |
/var/log/wtmp | All Linux / Unix | Binary database recording historical successful user logins, logouts, and system reboots. Read using last. |
/var/log/btmp | All Linux / Unix | Binary database recording historical failed login attempts. Read using lastb. |
/var/log/lastlog | All Linux / Unix | Sparse binary database tracking the most recent login timestamp for all system accounts. Read using lastlog. |
Systemd Journal Telemetry (journalctl)
Modern systemd-based Linux distributions capture centralized binary logs managed by systemd-journald stored in /run/log/journal/ (volatile) or /var/log/journal/ (persistent). SOC analysts query the journal using journalctl:
# Inspect all authentication events from the current boot session
journalctl -b _COMM=sshd
# Query events for a specific systemd unit with priority Warning or higher
journalctl -u nginx.service -p warning
# Stream logs in real time with timestamp precision
journalctl -f -o short-iso
Linux Audit Framework (auditd)
For enterprise environments requiring granular kernel-level tracking, the Linux Audit Framework (auditd) intercepts system calls directly through the kernel netlink socket. Audit rules are defined in /etc/audit/audit.rules (or /etc/audit/rules.d/) and loaded via auditctl.
# Sample auditd Rule Configuration (/etc/audit/rules.d/csa_audit.rules)
# 1. File Watch: Monitor modification of credential storage
-w /etc/shadow -p wa -k credential_tamper
-w /etc/passwd -p wa -k credential_tamper
# 2. File Watch: Monitor changes to administrative privileges
-w /etc/sudoers -p wa -k privilege_escalation
-w /etc/sudoers.d/ -p wa -k privilege_escalation
# 3. System Call Auditing: Capture all process execution (64-bit)
-a always,exit -F arch=b64 -S execve -k process_execution
Audit rules utilize three primary flags:
-w <path>: Sets a file system watch on the designated target path.-p <permissions>: Specifies permission filters to trigger on:r(read),w(write),x(execute), anda(attribute change).-k <key_name>: Attaches a searchable identifier string to all matching events.-a always,exit: Configures a system call filter that evaluates when a system call terminates.
Querying Audit Telemetry: ausearch and aureport
SOC analysts query audit logs using dedicated command-line utilities:
# Search for events matching the custom key 'credential_tamper'
ausearch -k credential_tamper
# Search for failed user login events
ausearch -m USER_LOGIN -sv no
# Generate an authentication summary report across all users
aureport --auth
# Generate a summary report of all executable commands run on the host
aureport -x --summary
macOS Unified Logging and Host Artifacts
Modern macOS uses the unified logging system, which collects structured messages from the operating system and applications into an in-memory and on-disk log store. The log command queries or streams this store. Analysts should scope queries by time and use predicates for fields such as process, subsystem, category, event message, and message type rather than exporting an unbounded stream.
# Review the previous hour for authentication-related messages
log show --last 1h --style compact --predicate 'process == "loginwindow" OR subsystem CONTAINS[c] "auth"'
# Stream new messages for a specific process during controlled testing
log stream --style compact --predicate 'process == "sshd"'
Useful macOS evidence also includes Apple System Log or application files that still write under /var/log, install history, quarantine metadata, launch agents and daemons, File System Events (FSEvents), shell history, and endpoint-security telemetry. Privacy controls can redact some message values, retention varies, and log erase or store rollover can remove local history. A robust collection design forwards security-relevant macOS telemetry to protected centralized storage and correlates it with identity, DNS, proxy, and EDR evidence.
In Windows Security Event logging, which Logon Type recorded under Event ID 4624 indicates that a user authenticated interactively across the network using Remote Desktop Protocol (RDP)?
A SOC analyst investigates potential credential dumping on a Windows domain member server. Which Sysmon Event ID and target access parameter specifically provides telemetry when an unauthorized process requests a handle to the memory of lsass.exe?
Which command and configuration flag in the Linux Audit daemon (auditd) configures a file system watch rule on /etc/shadow that records write operations and attribute modifications, tagging them with the search key credential_tamper?
During threat hunting across Windows server endpoints, a security analyst searches for unauthorized persistence mechanisms established through service creation. Which Windows Event log and Event ID records the installation of a new service, capturing the service executable path and service name?