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.
Related Posts
- Linux Basic Commands (ls/cd/mkdir/rm)
- How to Search Files with grep and find on Linux
- nginx Basic Configuration File Guide
- Docker Basic Commands (run/stop/rm/ps)
Recommended Cloud Hosting
Looking for reliable cloud infrastructure? Check out these developer-friendly services.
- Cherry Servers - High-performance VPS and dedicated servers
- Cloudways - Managed cloud hosting for developers