View error logs on Cloudflare

I want to see the logs of a domain on Cloudflare, what should I do? and see where?
Because i have a website that when i don’t use cloudflare proxy it works fine but when i turn on cloudflare proxy it gives 502 error so i want to see the logs to know where the problem lies and fix it