HTTP Kernel
Record each access to a controller.
Enable the source
The source needs no extra package. Enable it, then add #[Auditable] to the controller class or to one method:
symfonycorp_audit_log:
sources:
http_kernel: trueuse SymfonyCorp\AuditLog\Attribute\Auditable;
class BookController
{
#[Auditable]
public function delete(): Response {} // only this action is recorded
}The entry
Each access gives one ACCESS entry. A request that fails once its controller is resolved (an exception, a denied #[IsGranted]) is recorded too. A request rejected earlier, for example by access_control in the firewall, gives no entry. The context has these keys:
target: the route name. For a sub-request or a request with no route, the controller.routeandroute_params: the route and its parameters.path: the path of the URL.method: the HTTP method.controller: the fully qualified controller name.main_request:falsefor a sub-request.
Masked URL parameters
URLs can contain personal data, such as a reset token or an email. The bundle masks the route parameters token, password and email by default, in route_params and in path. Only the listed parameters are masked: a {resetToken} parameter is stored as it is.
Set your own list with a transformation for each parameter. Your list replaces the default one, and {} masks nothing:
symfonycorp_audit_log:
sources:
http_kernel:
sensitive_params:
token: hidden
email: keyed_hashSub-requests
Sub-requests (render(controller(...)), forward(), inline ESI fragments) are not recorded by default. Set sub_requests: true to record them:
symfonycorp_audit_log:
sources:
http_kernel:
sub_requests: true