Your Ad Here

Tuesday, April 13, 2010

View System Logs Live

If you want to monitor the system logs in a live environment, you can use the tail command with an option -f or -F.
This will work in any Linux/UNIX environment.
To exit from the view, you can use Ctrl + C. The same option can be used with any text based files to find the updation to the file in live environment.

Usage:

# tail -f /var/log/messages

or

# tail -F /var/adm/messages


tail -f will work as long as the underlying file we’re trying to read doesn’t change. If you’re trying to read a link to a file and the original file (and thus the link) changes, tail -f will not work.

For that reason, its better to use tail -F for such files as described above … or tail -f –retry

No comments:

Post a Comment