User, IP and request ID
A context provider adds values to each entry, from any source.
Providers
| Provider | Context key | Package |
|---|---|---|
request | ip: the client IP, truncated by default | - |
user | user_identifier: the logged-in user. During a user switch, it is the impersonated user, and impersonator_identifier is the original user | symfony/security-bundle |
transaction_id | transaction_id: one UUID per request | - |
Enable the providers
symfonycorp_audit_log:
context_providers:
request: true # anonymize_ip is true: 192.168.1.42 is stored as 192.168.1.0
user: true
transaction_id: trueThe transaction_id value is the same for all the entries of one request. Use it to group these entries.
Personal data
The user identifiers and the client IP are personal data.
anonymize_ipistrueby default:192.168.1.42is stored as192.168.1.0, and IPv6 keeps the first 48 bits. This reduces the data you keep, but the result is not anonymous. Set it tofalseto store the full IP address.- The bundle stores the user identifiers as they are.
- Behind a proxy or a load balancer, set
framework.trusted_proxies. Otherwise,ipis the address of the proxy.
#[AuditTransform] does not apply to these values. To pseudonymise them, change them in a PreAuditLogEvent listener. See Transformations.
Your own provider
To add your own values to each entry, implement ContextProviderInterface. See Extend the bundle.