For a system administrator, it is very important to view log files for monitoring systems and troubleshoot issues. There are many ways to see the logs in real-time on a Red Hat Enterprise Linux (RHEL)system. tail command is a most useful solution which helps system admins to output the content of a file while the file is changing or continuously updating.
Monitor Logs in Real Time: tail command
tail command is the most useful solution to display the content of a log file in real-time. Use the tail command with -f option to display the content of the log file in real-time.
[user@dbappweb.com ~]$ sudo tail -f /var/log/httpd/ssl_access_log
You can also use the tailf instead of tail -f
[user@dbappweb.com ~]$ sudo tailf /var/log/httpd/ssl_access_log
Normally, the log files are rotated frequently on an RHEL system by the logrotate utility. To watch log files that get rotated on a daily or weekly base you can use the -F option with the tail command.
The tail -F will keep track of the new log file being created due to the log rotation policy and it will start following the new file instead of the old file.
[user@dbappweb.com ~]$ sudo tail -F /var/log/httpd/ssl_access_log
Last Updated: August 05, 2020
Related Posts
- How to Find Out RHEL 6 / RHEL 7 Kernel Version
- How to Find Last Patch Date of RHEL Servers
- Define Password Policy and Aging in Linux/RHEL 6
- How to Disable SELinux in RHEL
- Linux command to get Hardware Serial Number
- How to sort the directories in Linux/RHEL
- How to view/print routing table in Linux
- How to Disable Root SHH Login in RHEL
- How to Set or Change System Hostname in RHEL 7