Introduction
Know who did what, and when, in your Symfony application.
What is SymfonyAuditLog?
The bundle records an audit trail of the actions in your application. It records Doctrine changes, controller access, console commands, logins, Messenger messages and workflow transitions. It stores the trail where you want: a SQL table, Elasticsearch, MongoDB, a file or stdout.
- Opt-in: add
#[Auditable]to a class and enable a source. Nothing else is recorded. - Safe: by default, an audit failure never breaks your application. It only logs the failure.
- Privacy tools: mask, hash or ignore chosen fields before they are stored.
- Tamper-evident: an optional HMAC hash detects a changed entry.
- Audited reads: the bundle records each read, check and purge of the entries by its commands and its EasyAdmin viewer. You cannot disable it.
- Ready to read: console commands, an EasyAdmin viewer, a PHP reader, a profiler panel and PHPUnit assertions.
- Extensible: write your own source, output, formatter, reader or transformer.
How it works
An entry has a source, an action, a message, a date and a context: key-value data such as the user or the changed fields.
- A source listens to a part of Symfony and creates an entry. Your code can also create one.
- AuditLogger adds values to the context (user, IP) and calls your listeners.
- An output adds the optional hash and stores the entry. Some outputs can also read the entries back.
Nothing is recorded by default
Enable at least one source and one output. Then add #[Auditable] to the classes to record:
use SymfonyCorp\AuditLog\Attribute\Auditable;
#[ORM\Entity]
#[Auditable]
class Book
{
// each INSERT, UPDATE and DELETE is recorded
}GDPR, ISO 27001 and SOC 2
The bundle gives evidence for your GDPR, ISO 27001 and SOC 2 audits: who did what and when, who read the entries, and which entry changed. See the status of each rule in GDPR, ISO 27001, SOC 2.
Good to know - the bundle does not make your application compliant or certified.
Backward compatibility
The bundle follows the Symfony backward compatibility promise.
Next steps
Go to Installation to install the bundle and record your first entry. Then see Configuration for all the options.