tail -F

tail -F -q and piping to other commands (configuring buffering of other commands)

Use [tail -F] (capital F) instead of [tail -f] when tailing log files.

If you want to pipe output of tail -F to commands like grep or jq then look into configuring them so they buffer per line rather than holding on to larger buffers, look at the following notes:

Also make sure to user -q when piping structured logs (like JSON per line logs) to tools like jq.

IF you are working with a file that does not end with an empty line, and you are piping the content from tail -F then prefix tail -F with stdbuf -oL.

Otherwise tail -F is NOT going to output the last line from your file. And you could end up with very confusing tailing missing that last event.


Children
  1. Use [tail -F] (capital F) instead of [tail -f] when tailing log files.
  2. with: stdbuf -oL

Backlinks