Here’s a neat little trick for those of you with SSH access to your Linux server. You can use a simple command to get a live-updated stream of your access log, so you can see hits as they come in. It’s sort of like the “spy” tool in Woopra or pMetrics, but geekier and with less visual polish.
First you need to connect to the server with SSH. Once you’re in, change your working directory to wherever Apache stashes its log files on your system. On my Ubuntu install it’s
/var/log/apache2. So I would type
cd /var/log/apache2 to switch to that directory. Next, run the
tail command like so:
tail -f access.log
Tail normally outputs the last several lines of a file and then returns to a prompt, but with the
-f argument it continues to monitor the file for changes, and outputs them. So as the Apache server writes to the log file,
tail spits the new lines out on your screen.
When you’re done, press
Ctrl+C to terminate the tail process and go back to the shell prompt.