Watching logs

I have a webserver with about a dozen active domains. Sometimes I want to take a quick look at the ongoing action on a particular domain. I have an alias called “watchlog” that takes the domain name as an argument. It shows me the last 25 lines of the log for that domain and then new ones as they come, until I kill it.

It’s a tcsh alias (sorry, bash users):

alias watchlog tail -f -n 25 /usr/local/www/domains/\!:1/logs/access_log

(Obviously this depends on a setup where domain folders are named after the domains themselves, with logfiles in consistent relative locations with standard names.)

Share: