Basic Usage

tail -f /var/log/nginx/error.log   # Monitor error log
tail -n 100 -f logfile             # Start from last 100 lines

Press Ctrl + C to stop.

Filter for Errors Only with grep

tail -f /var/log/nginx/error.log | grep "error"

Monitor Docker Container Logs

docker logs -f CONTAINER_ID
docker logs -f --tail 100 CONTAINER_ID

Common Log File Locations

/var/log/nginx/error.log     # nginx error log
/var/log/syslog              # System log
/var/log/auth.log            # Authentication log

To filter log output with more advanced patterns, combine tail -f with How to Search Files with grep and find on Linux.

Looking for reliable cloud infrastructure? Check out these developer-friendly services.