Quick Linux Tip #30:
Try: tail -f /var/log/nginx/error.log | grep --line-buffered -E --color=always 'error|warn|critical|$'
Info: --color=always highlights matching text. The |$ pattern matches every line so non-matching lines still display. --line-buffered ensures real-time output.
Examples:
- $ tail -f app.log | grep --line-buffered --color=always -E 'ERROR|WARN|$'
- $ journalctl -f | grep --line-buffered --color=always -E 'Failed|Error|$'
- $ multitail /var/log/nginx/error.log /var/log/nginx/access.log # Watch multiple
Note: Without --line-buffered, piped output can be buffered into chunks instead of appearing immediately. For advanced multi-file tailing with custom colors per window, use multitail.
Leave a Reply