BashItOut

Using tail to recieve live log updates

Checking log files can be such a pain sometimes, especially if you’re doing it regularly. For example, when I’m coding up a web app, I find it useful to keep an eye on the Apache error logs with something like this :

tail /var/log/apache2/error.log

However, if I add the option -f to tail, it will follow the file I’m reading and give me live updates as and when new lines are added.

tail -f /var/log/apache2/error.log

Instead of exiting after it has read the file, tail will now stay open and update new lines in the terminal as they appear. To exit, just use ctrl-c

This will work with any other text files that get updated, for example, if you like to know when people are viewing your page, live, check out the access logs with :

tail -f /var/log/apache2/access.log

Tags: Linux

blog comments powered by Disqus

About

@MTerzza Twitter Icon

+MikeTerzza Google Plus Icon

Atom | RSS RSS Icon

Recent Posts:

Monitoring the progress of dd

RTL SDR Frequency Drift Offset

Random Seriousness with Python and Password Generation

Random Fun and the Busy Linux Geek

Ampersands & on the command line