[Novalug] 'tail --follow=name filename' to keep tailing the file
American Dave
novalug@soupy.org
Fri Mar 6 16:10:09 EST 2009
Doug wrote:
> one of the bad things (if there are really any bad things about it)
> about using unix/linux for so long is that it's easy to not go back
> and browse the man pages every now and then to notice improved command
> arguments. i keep tail running on a tomcat log file on my desktop.
> each night log rotation goes and moves it causing a new one to get
> created. if you use 'tail -f name', tail will not "see" the new file
> and just sit there forever looking at the old file.
> i noticed from 'man tail' that there is a '--follow=name' argument
> that tells tail to re-open the file every now and then in case it gets
> deleted/recreated.
>
> an example usage is:
> tail --follow=name filename
>
> i just thought that i'd pass it along in case anyone else has been
> ruthlessly killing and restarting tail every day like i've been for
> weeks.
Doug:
Thanks for pointing it out as I've certainly tailed files that get rotated. I also appreciate that you pass along useful info when you find it.
You may already know this, but you can tail multiple files with:
tail -f /var/log/syslog /var/log/auth.log
Thanks,
-A. Dave
More information about the Novalug
mailing list