Piping tail output though grep twice

I believe the problem here is that the first grep is buffering the output which means the second grep won’t see it until the buffer is flushed.

Try adding the --line-buffered option on your first grep:

tail -f access_log | grep --line-buffered "127.0.0.1" | grep -v ".css"

For more info, see “BashFAQ/009 — What is buffering? Or, why does my command line produce no output: tail -f logfile | grep 'foo bar' | awk ...

Leave a Comment