我可以使用`-f`标志过滤`tail`的输出吗?

我想要在RHEL 6.8中使用access_log的输出,但是使用pipe和grep作为filter。 有这样的select吗?

这是我想从现场输出:

 # tail -f error_log | grep <<ON.THIS.IP.ADDY>> 

目前我正在做类似这样的事情,但它很笨拙:

 watch -n 5 'tail -n 10 access_log | grep <<ON.THIS.IP.ADDY>>' 

我只是做了一个tail -f <nginx-access.log> | grep <ip> tail -f <nginx-access.log> | grep <ip>和预期的新线定期出现。

当你尝试时会发生什么? 这可能是你的grep缓冲区(我想我已经看到了),在这种情况下,它可能有助于添加--line-bufferedgrep