Docs / Context Providers / User, IP and request ID

User, IP and request ID

A context provider adds values to each entry, from any source.

Providers

ProviderContext keyPackage
requestip: the client IP, truncated by default-
useruser_identifier: the logged-in user. During a user switch, it is the impersonated user, and impersonator_identifier is the original usersymfony/security-bundle
transaction_idtransaction_id: one UUID per request-

Enable the providers

config/packages/symfonycorp_audit_log.yaml
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: true

The 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.

#[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.