View remote log files with Console and ssh

Jul 11, '06 07:30:00AM

Contributed by: ryans

Ever wanted to grab a log file entries from a remote machine on your local machine? Here's one way to do it. In Terminal, connected to a remote host, run tail -f on the log file you want to view, and then direct the output to a local file with a .log extension. For example:

$ ssh remotehost "tail -f /var/log/httpd/access.log" >> remote-httpd.log
(You'll have to replace remotehost with the full name/IP address of the remote host, obviously.) Note that the command will not return a command prompt. Now launch Console, use File: Open within the application, and point it to the local file with the .log extension you named in the Terminal command.

Now you can use Console's features to view your remote log files in real time. When you want to stop the logging, switch back to Terminal and hit Control-C to stop the ssh command that is sitting in your Terminal window.

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060707143735901