Filipus Klutiero wrote: > tail --follow is useful to see what is being added to a file. > However, if the monitored file is followed for a certain period, it > doesn't indicate when the new content was added. It would be nice if > tail allowed to prepend timestamps to the output, as MultiTail's -ts > option does.
But, but, but... multitail already does this. > This is a little delicate to do. The timestamp could be prepended to > each line, or only to each atomic addition to the file. Also, as we > don't know when the existing lines were added, we can't give them an > exact timestamp. MultiTail stamps them with the time of MultiTail's > launch, but I find that a bit misleading. I would consider simply > not stamping these. As you note there is no clean solution for those previously added lines. No matter what is done it cannot be correct. > In any case, as this alters the output, this should be optional. > > Scanning the changelog suggests this has not been implemented as of 8.21. This is most easily done using normal tools already. As you know the philosophy is that programs should do one thing and then those should work together to build more complex things. For example here is one way to do what you are asking. And this is just one of many possibilities. $ tail -f /var/log/syslog | perl -MPOSIX -lne 'print strftime("%T ",localtime()), $_;' Also there already exists multitail which does what you are asking. If so then why not simply use multitail? Is the natural progression that tail be mutated into multitail? In that case we should simply use multitail directly. But that does have a size penalty. $ ll -h /usr/bin/tail /usr/bin/multitail -rwxr-xr-x 1 root root 264K Jan 23 2012 /usr/bin/multitail -rwxr-xr-x 1 root root 67K Nov 18 08:25 /usr/bin/tail Bob
signature.asc
Description: Digital signature