The error message
kernel: nstat_lookup_entry failed: 2 crops up with varying frequency in the kernel log (
/var/log/kernel.log) in OS X 10.7–10.7.2 and has lead to a lot of speculation as to its root cause.
Here are some facts on the situation: The message is generated by a kernel component that has only been added in OS X 10.7 Lion, which can be seen in the source code (for OS X 10.7.1).
The error message is generated at line 1554:
For OS X 10.–10.7.2, the only way to guarantee that this error message does not reach your kernel log would be to disable the network statistics feature with the
sysctl interface to the kernel.
This page previously offered a way to turn off the network statistics feature permanently. However, since 10.7.3 and later versions of OS X do not suffer from this cosmetic issue anymore, it is highly recommended to undo that modification.
First check whether you have that feature turned off by running
If there is only the line
simply remove the file
/etc/sysctl.conf, by running the following command
Otherwise, edit the file and remove that line.