1. Update DNS Options:
configure
set service dns forwarding options 'log-queries'
commit
save
2. Create new file ‘/etc/rsyslog.d/dnsmasq.conf’
$ModLoad imfile
$InputFileName /var/log/dnsmasq.log
$InputFileTag EdgeDNS
$InputFileStateFile EdgeDNS1
$InputFileSeverity notice
$InputFileFacility local1
$InputFilePersistStateInterval 1000
$InputRunFileMonitor
*.* <@SYSLOG_SERVER_HOST_NAME OR @@SERVER_IP_ADDRES
3. restart dnsmasq and rsyslog service
sudo service dnsmasq restart
sudo service rsyslog restart
办法来自 https://community.ubnt.com/t5/EdgeRouter/Log-DNS-query-to-syslog/m-p/2267821#M199787