How to Follow Log Files and Handle Log Rotation with tail
This article explains how to use the Linux tail command to monitor log files in real time, filter errors, and reliably continue following logs after rotation by using the -F option, providing practical guidance for system administrators and developers.
How to follow log files tail -f /path/to/log/file | grep -i error This command is commonly used to watch a log for suspicious entries such as error output.
What to do when log rotation occurs tail -F The manual page for tail explains that -F is equivalent to --follow=name --retry, which makes tail follow the file name even after rotation, useful for files like Tomcat's catalina.out.
Author: He Weiping, Qunar Travel Division, search technology and database researcher, translator of the first Chinese PostgreSQL manual and the third edition of Programming Perl, with nearly 18 years of IT experience.
The article is originally from the company wiki “老何的1001夜”. Qunar colleagues can log in to the wiki for more articles.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
