By Juri
Hello i have a route like this in symfony app for health checks in digital ocean load balancer:
/**
* Status page. It is accessible only internally from within the network
*
* @Route("/status", name="index_status", methods={"GET"})
*
* @param Request $request
*
* @return Response
*/
public function statusAction(Request $request): Response
{
return new Response('Happy PDF printing');
}
And my monolog configuration looks like this:
monolog:
handlers:
main:
type: 'fingers_crossed'
channels: ['!security']
action_level: info
excluded_http_codes: [403, 404, {200: ['^/ping(.+)', '^/status(.+)', '^/status?q=%2Fstatus', '^cloud.digitalocean.com/status?q=%2Fstatus']}]
handler: file
file:
type: stream
level: debug
path: "%kernel.logs_dir%/app.log"
formatter: Monolog\Formatter\JsonFormatter
include_stacktraces: true
However i can’t make monolog to not save logs about status requests from load balancer, they are made with request_uri like this http://cloud.digitalocean.com/status?q=%2Fstatus. Any idea if it’s possible to exclude them from symfony app?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I think that it might be because of the GET parameters in your status route: /status?q=%2Fstatus, maybe it is a good idea to try and change the route so that it does not require a get parameter, that way the excluded_http_codes rules should work.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.