Auto-refresh files when using tramp


I am viewing remote log files using tramp mode in emacs. Is there a way to get tramp to auto-refresh these buffers when they change remotely? If this is not possible, is there a way to reload a buffer every time it is opened?

I have tried to set (global-auto-revert-mode t), but this does not work.

Edit: Just found out that this is intended behaviour:

You can also tell Emacs to revert buffers periodically. To do this for a specific buffer, enable the minor mode Auto-Revert mode by typing M-x auto-revert-mode. This automatically reverts the current buffer every five seconds; you can change the interval through the variable auto-revert-interval. To do the same for all file buffers, type M-x global-auto-revert-mode to enable Global Auto-Revert mode. These minor modes do not check or revert remote files, because that is usually too slow.

shareimprove this question

There is a customizable variable named auto-revert-remote-files, which does what you want.

shareimprove this answer