【发布时间】:2016-12-16 12:18:43
【问题描述】:
为了列出 OSX 10.11.6 中的 DNS 缓存条目,我尝试了dscacheutil -statistics,但没有成功。
$ sudo dscacheutil -statistics
Unable to get details from the cache node
如何在不刷新的情况下打印 DNS 缓存中的内容?
【问题讨论】:
标签: dns osx-elcapitan oscache
为了列出 OSX 10.11.6 中的 DNS 缓存条目,我尝试了dscacheutil -statistics,但没有成功。
$ sudo dscacheutil -statistics
Unable to get details from the cache node
如何在不刷新的情况下打印 DNS 缓存中的内容?
【问题讨论】:
标签: dns osx-elcapitan oscache
正如@PrasseethaKR 和@kjagiello 指出的那样,在High Siera 上,mDNSResponer 已从syslog 移动到log。此外,您的 DNS 查找消息现在被视为私有消息,默认情况下将在控制台和 log stream 中显示为 <private>。
要查看您在 High Sierra 上的 DNS 查找,请打开终端并运行:
sudo log config --mode "private_data:on"
log stream --predicate 'process == "mDNSResponder"' --info
要返回使用私有,只需运行以下命令。
sudo log config --mode "private_data:off"
干杯!
【讨论】:
mDNSResponder(多播 DNS 守护程序)SIGINFO 信号可以将内部状态的快照摘要转储到 /var/log/system.log,包括缓存详细信息。为此:
在一个终端中保持系统日志打开:
tail -f /private/var/log/system.log
从另一个终端向 mDNSResponder 发送一个 SIGINFO 信号:
sudo killall -INFO mDNSResponder
然后在第一个终端检查日志,你将能够看到缓存转储:
mDNSResponder[98]: ------------ Cache -------------
mDNSResponder[98]: Slt Q TTL if U Type rdlen
mDNSResponder[98]: 52 1827 -U- CNAME 17 www.sublimetext.com. CNAME sublimetext.com.
...
...
mDNSResponder[98]: Cache currently contains 154 entities; 3 referenced by active questions
(更多信息:man mDNSResponder)
【讨论】:
sudo killall -INFO mDNSResponder 的日志,请打开 Console 应用,在左侧边栏中选择您的设备,然后应用搜索过滤器 mdnsresponder,在那里可以看到DNS缓存日志。
log stream --predicate 'process == "mDNSResponder"' --info