Replace your router's DNS with something like pi-hole or a bog standard dnsmasq, turn up the logging, that's it. Ubiquiti devices I think also offer detailed DNS logging but not sure.
I believe unifi offers aggregated dns logs ootb but you could always set up more detailed ones on the gateway itself.
I believe unifi offers aggregated dns logs ootb but you could always set up more detailed ones on the gateway itself.