tail & tail -F

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

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:

-

Key Differences

  • tail -f follows the file descriptor - stops working if file is deleted/rotated
  • tail -F follows the file path - automatically reconnects when file is recreated

Why This Matters for Logs

Log rotation tools (logrotate, etc.) commonly:

  1. Move app.log to app.log.1
  2. Create a new empty app.log
  3. Signal the app to start writing to the new file

With tail -f: You'd be stuck watching the old rotated file With tail -F: Automatically switches to the new file

Bottom Line

# This stops working after log rotation
tail -f /var/log/app.log

# This keeps working through log rotations  
tail -F /var/log/app.log

Always use tail -F for production log monitoring.


Children
  1. tail -F