Docs / Sources / Security

Security

Record each login, login failure, logout and user switch.

Enable the source

The source needs symfony/security-bundle. It needs no attribute: each authentication event is recorded.

config/packages/symfonycorp_audit_log.yaml
symfonycorp_audit_log:
    sources:
        security: true

The entries

ActionContext
LOGINuser_identifier, firewall
LOGIN_FAILUREfirewall, exception: the exception class
LOGOUTuser_identifier
SWITCH_USERtarget_user: the user that is impersonated

A LOGIN_FAILURE entry does not have the identifier that the user typed. So you cannot count the failures of one account.

With the user context provider, each entry made during a user switch also has impersonator_identifier, the original user.