![]() Lnav utility can also watch and follow multiple files and display their content in real time. lnav Command – Monitor Multiple Log Files in Real TimeĪnother interesting command, similar to multitail command is the lnav command. $ sudo multitail /var/log/apache2/access.log /var/log/apache2/error.log To display the output of two log file simultaneous, execute the command as shown in the below example. To install mulitail utility in Debian and RedHat based systems issue the below command. Multitail also lets you navigate back and forth in the monitored file. The name of the command implies that multitail utility can monitor and keep track of multiple files in real time. Multitail Command – Monitor Multiple Log Files in Real TimeĪnother interesting command to display log files in real time is multitail command. $ sudo tail -n2 -f /var/log/apache2/access.log For instance, if you want to watch in real time only the last two lines of the log file, use the -n file combined with the -f flag, as shown in the below example. However, by default, tail command will display the last 10 lines of a file. $ sudo tail -F /var/log/apache2/access.log The tail -F will keep track if new log file being created and will start following the new file instead of the old file. Read Also: How to Manage System Logs (Configure, Rotate and Import Into Database) in Linux To watch log files that get rotated on a daily base you can use the -F flag to tail command. Usually, the log files are rotated frequently on a Linux server by the logrotate utility. You won’t need to use the -f switch because the command is built-in with the -f argument. The second version of the command is actually a command itself: tailf. $ sudo tail -f /var/log/apache2/access.log In the first example the command tail needs the -f argument to follow the content of a file. However, the command to display the file has two versions, as illustrated in the below examples. tail Command – Monitor Logs in Real TimeĪs said, tail command is the most common solution to display a log file in real time. Read Also: 4 Good Open Source Log Monitoring and Management Tools for Linux 1. Some of the most known and heavily used utility to display a file content in real time in Linux is the tail command (manage files effectively). How can I see the content of a log file in real time in Linux? Well there are a lot of utilities out there that can help a user to output the content of a file while the file is changing or continuously updating.
0 Comments
Leave a Reply. |