Multiple clustered test environments with a multitude of log files could be a real pain to work with. The number of manual steps needed to get a few log windows rolling on the desktop can be minimized to a simple double-click by following the few steps outlined below.
Prerequisites
- Windows 7/XP
- Cygwin
How
In short,
- Store away all authentication keys
- Create a set of batch files for kicking up a console window tailing a log file
Cygwin
A Cygwin installation is needed to get this to work. It is important that the following TWO packages are installed.
- openssh
- rxvt “Terminal emulator”
Also make sure that the Cygwin /usr/bin path (usually C:\Cygwin\bin) is added to the Windows system path.
Storing away all keys/passwords
To get the automatic login to work all authentication keys needs to be stored away. This is easily done through Cygwin. Use ssh-keygen and press enter (use default values) for all questions.
$ ssh-keygen -t dsa
Now it is time to create a key for each and every host where there might be a log file to be tailed. Replace the user name and host name and repeat the step below until a key has been created for each host. Answer ‘yes’ where needed and give the asked for passwords.
$ cat .ssh/id_dsa.pub | ssh remoteUser@remoteHost 'cat >>.ssh/authorized_keys'
Batch script
For each logfile where a quick link is wanted create a Windows batch script and paste the contents below. Then replace the values in the definitions at the top and of course the path to the log file. Note that this starts an interactive shell and it will not work if the /usr/bin (check Cygwin installation above) path has not added to the Windows system path.
@ECHO OFF
set hostName=remotehost.se
set yourLoginName=andnyb
C:\cygwin\bin\rxvt.exe -title "Server log - %hostName%" -sl 200 -fg white -bg black -geometry 120x36+0+0 -fn 8x14 -e ssh %yourLoginName%@%hostName% "cd /pathToLogs; tail -f server.log"
There you go, double-clicking on one of these files will open up an rxvt terminal window that tails the given log file.