3

I need to find how to display my DNS cache on the mac. I have tried multi Google searches but failed to come up with a good solution. The best I found was how to remove the cache with the command sudo killall -HUP mDNSResponder which is great but I need to see the cache to see if the change works.

4

As @PrasseethaKR and @kjagiello point out, on High Siera mDNSResponer has moved from syslog to log function. In addition, your DNS lookups are now considered private and will show as such in both Console and log stream.

To view your DNS lookups in real time on High Sierra open an Terminal and run:

sudo log config --mode "private_data:on"
log stream --predicate 'process == "mDNSResponder"' --info

To go back to using private just run the following command.

sudo log config --mode "private_data:off"

AFAIK you cannot view the contents of old private messages, only messages logged with private_data:on can appear. To view your entire history use the show command Because it can return a large amount of data I also use --last to limit the data, e.g. the last 2 hours would be...

log show --last 2h --predicate 'process == "mDNSResponder"' --info

Cheers!

| improve this answer | |
2

To see the DNS cache, you can use the following command in Terminal to dump a snapshot summary of the internal state of mDNSResponder to /var/log/system.log:

sudo killall -INFO mDNSResponder

Then to review, you can either use Console and filter using mDNSResponder or since Terminal is already handy just use:

grep mDNSResponder /var/log/system.log

To flush the DNS cache, use the following command:

sudo killall -HUP mDNSResponder
| improve this answer | |
  • 4
    That didn't work for me on High Sierra – tom Oct 10 '18 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .