This is a copy of the same func in log-dnslog.c, may want to move this to a common file.