How to monitor only the last n lines of a log file?
It might suffice to use watch:
$ watch tail -n 15 mylogfile.txt
If you use watch, try the -n
option to control the interval between each update.
Thus, the following would call tail every 2 seconds
$ watch -n 2 tail -n 15 mylogfile.txt
while this one polls it every 1 second
$ watch -n 1 tail -n 15 mylogfile.txt
You could stream the logfile running less and pressing SHIFT + F that will stream the file using less.
$ less mylogfile.txt
Then just press SHIFT + F and it will stream. I think it is convenient for monitoring log files that update.