Binary Log (Database)
Definition
A database engine's sequential record of all committed data modification statements, used primarily for replication and point-in-time recovery. In MySQL and MariaDB, the binary log is the most complete forensic record of write activity when the general query log is not enabled. On PostgreSQL the equivalent is the write-ahead log (WAL).
- Systems
- MySQL, MariaDB
- Records
- Committed data modification statements
- Primary uses
- Replication, point-in-time recovery
- PostgreSQL equivalent
- Write-ahead log (WAL)
Common questions
Why is the binary log forensically valuable compared to the general query log?+
The general query log records every statement including reads and is often disabled for performance, while the binary log captures only committed writes and is commonly left enabled because replication depends on it, making it the more available evidentiary source in practice.
Does the binary log show who made a change or just what changed?+
It records the statements or row changes themselves, not user identity directly, so correlating an entry to a specific user typically requires cross-referencing the database's connection or audit logs from the same time window.
Related terms
- Combined Log Format
- An extension of the Common Log Format used as the default by Apache HTTP Server and widely adopted by Nginx. Adds referrer...
- Indicator of Compromise (IoC)
- An observable artefact that suggests a system has been involved in a malicious event. Static analysis produces file-based IoCs: cryptographic hashes, embedded...
- Log Rotation
- The scheduled process of closing the current log file, compressing it, renaming it with a date or sequence suffix, and opening a...
- SIEM
- Security Information and Event Management. A platform that ingests log streams from multiple sources, normalises them to a common schema, and applies...
- Syslog (RFC 5424)
- A standard protocol and message format for transmitting log data from Unix-like systems and network devices to a centralised collector. Each message...