Http Requests Monitoring
Monitor your application behaviour during incoming http requests.
Introduction
To activate inspection when your application is executed by an incoming http request you can use the WebRequestMonitoring
middleware.
Thanks to the middleware you are free to decide on which routes you want activate monitoring, based on your routes configuration or on your personal monitoring preferences. WebRequestMonitoring
middleware works like any other Laravel middleware you are familiar to.
If you use Laravel Octane to serve your application you should use the specialized middleware instead. Go to the Octane integration guide.
Option 1 - Append to the middleware groups (recommended)
Laravel 11
You should append the Inspector middleware in the bootstrap/app.php file for web
and api
middleware groups, so in two lines of code you'll intercept all incoming http requests:
Previous Laravel versions (<= 10)
For previous Laravel version up to 10 you should append the Inspector middleware to the middleware gourps in the App\Http\Kernel
class:
Option 2 - Assigning middleware to routes
In alternative you can assign the middleware to specific routes or group:
Ignore Http Requests
Basic ignoring logic is supported by default via a simple configuration parameter. Learn more here.
If you need to implement a custom logic to ignore requests, the middleware is also designed to be extended.
Overwriting the shouldRecorded()
method, you can implement a custom condition to decide which routes should be ignored by Inspector.
Run the artisan command below to create a new middleware class:
In the new middleware class extend the Inspector middleware and override the shouldRecorded()
method to implement your condition. Return back a boolean value to enable or disable monitoring:
Returning true
the current http request will be recorded in your dashboard, returning false
the transaction will be completely ignored.
The last step is to use this new custom middleware instead of the original Inspector middleware.
Laravel 11
Previosu Laravel version (<= 10)
Hide sensible contents
You may hide sensible data from HTTP requests body and Headers like passwords, authorization token, etc. Inspector is able to detect that parameters in your request's content masking them with "******".
Simply add fields to the hidden_parameters
array in the in inspector config file:
You can specify nested fields using the dot notation like user.password
Last updated