Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have to tail the log of a server (servicemix) and the log rotation is enabled. As soon as the rotation happens, tail stops displaying. I did some investigations and it is a bug in Debian : Debian Bug Report. The bug has been around for a long time ago. Does anyone knows if this bug in Ubuntu is to be fixed?

I'm on Ubuntu 12.04 64 bit. I don't have to mention that this bug is total hell! Every time I have the problem, I have to interrupt the command tail and re-execute the command!

share|improve this question
It is true that I can disable the log rotation. But I would like this problem to be fixed... –  Rudy Vissers Oct 18 '12 at 10:33

3 Answers 3

The Gnu coreutils version of tail has the --follow[={name|descriptor}] parameter, which allows you to follow the file name rather than the descriptor. It continues to tail files even after they rotate or truncate. From the help output:

With --follow (-f), tail defaults to following the file descriptor, which means that even if a tail'ed file is renamed, tail will continue to track its end. This default behavior is not desirable when you really want to track the actual name of the file, not the file descriptor (e.g., log rotation). Use --follow=name in that case. That causes tail to track the named file in a way that accommodates renaming, removal and creation.

I'm on Fedora, but I believe that you can install the Gnu coreutils on Ubuntu with the following command:

sudo apt-get install coreutils
share|improve this answer

You can automate the interruption and resumption of your tail command by adding the requisite commands to your logrotate configs. See - in short, you will probably want to put the command in /etc/cron.daily/logrotate, the system-wide crontab which handles rotation.

share|improve this answer

As stated in the bug report, you can bypass the malfunctioning inotify code with:

tail ---disable-inotify servicemix.log

It will then use an older polling behavior.

share|improve this answer
I have just tested the workaround and it does not avoid tail to block... :-( –  Rudy Vissers Oct 18 '12 at 14:38
I did a second check and it is indeed the case on ubuntu 12.04 and debian...tail not working... That is not acceptable... –  Rudy Vissers Oct 19 '12 at 11:46
@RudyVissers Have you filed a bug report with Ubuntu yet? –  hexafraction Oct 19 '12 at 13:33
I understand that this is not acceptable for you, but it may be of nu use to complain here as coreutuils is from Debian. Since this problem is not localized to Ubuntu, it is best to ask at Unix & Linux. –  hexafraction Oct 19 '12 at 13:46
You are right and I will do that as soon as I find some time. –  Rudy Vissers Oct 31 '12 at 9:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.