Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'View remote log files with Console and ssh' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View remote log files with Console and ssh
Authored by: ianeiloart on Jul 12, '06 02:24:57AM

This is a very cool tip. Of course, if you're happy with viewing the logs in the Terminal, you just shell in and tail the log.

Here's a few related tips:

Put the local copy of the log in

~Library/Logs/Remote
and you can use Console's "File...Open Quickly" feature.

If the log doesn't get updated frequently, you can use Console's alert features (see "Console...Preferences") - either bounce the icon in the dock or bring the window to the front when an event is logged.

Console's filter feature is good - type a word in the title bar, and only matching lines will be displayed. Unfortunately, all log updates will trigger the alerts - not just matching lines.

If you want to be alerted to specific events (like a rejection in a mail log), then use a command like this in conjunction with Console's alert features:

ssh mailserver "tail -f /var/exim/log/exim_smtp_mainlog" | grep 'rejected' >> Library/Logs/Remote/mailserver.smtp.log

Only matching lines will be put into the local copy. You can use egrep to do sophisticated pattern matching, if you like. For example:

ssh mailserver "tail -f /var/exim/log/exim_smtp_mainlog" | egrep -i 'apple|banana' >> Library/Logs/Remote/mailserver.smtp.log

will match lines containing either apple or banana, with case insensitivity.

---
--
Ian Eiloart

[ Reply to This | # ]