Home / Software / Watching Linux logs live

Watching Linux logs live

Mario and Luigi checking Linux logs
Question: How can I watch information come into my Linux server logs as they arrive?

Answer: Linux has a nifty little command called “tail” that allows you to see the latest log file messages, but that by itself will not show you the latest messages as they arrive in real time. For that, all you have to do is add the “-f” tag to the end of the tail command. For example, if you want to watch mail server messages as they arrive, enter as root:

tail -f /var/log/maillog

Similarly, for Apache web server access logs, you would enter something like:

tail -f /var/log/httpd/access

And for web server errors:

tail -f /var/log/httpd/errors

Generally speaking, it will occupy your command prompt, not allowing you to do anything else. If you want to keep working and do not mind being interrupted whenever a message comes in, you can add the &, and it will return you to the command line.

tail -f /var/log/maillog &

Photo Source: Flickr

Check Also

Uk data center

Professional Data Centres In The UK

A professional data centre is a location in which various pieces of hardware are located …