What Happened?

When there is any fault like power failure or hard disk failure it can be a planned or not planned (Unplanned) process, Then we can use Logs to determine what happened or the possibilities of issues that can occur.

cd /var/log

 

Some of the files in /var/Log are in the text which is in regular form, others are compressed files and directories. Suppose we want to check the names which have errors in their names but it may be time-consuming.

Example: Examining logs to identify the errors process 

Suppose There is a case when our Local area network clients are not able to print the network printers. So in this case first we have to go into the /var/log/cups directory and we have to find what is there then we have to use the tail command to display the last 10 lines of an error log, or we can also use the -f error log.

# cd /var/log/cups
# ls
# tail access_log

Log files Monitoring

Example: Examining the logs for hardware failures

Suppose we have a case of hardware failure as they are really difficult to troubleshoot we should check the messages logs for the hardware part.

cd /var/log/messages
ls

So in this, we will look at Linux system logs files. first, we have to use the cd command to go to this directory “/var/log” and then the list of all the files and folders using the “ls” command. So we can see the list of files and folders present inside it. These files and folders contain the logs records. 

 

As told earlier most of the time the system logs are saved in “Syslog” for the “/var/log” folder. So we can display the log records in the “Syslog” directory. For this, we have to use the sudo command. This is always started with the keyword sudo at the beginning we have to use cat to open the “Syslog” shown in below image

 

Let us focus on another file which consists of our logs files in the folder “/var/log”. This time we will opt for the “dmesg” files in this folder. It has simple log files and records.

 

The records inside the log files are always specified by type i.e error failed, ward, etc as we have seen in the previous picture. Let us specify our sudo command with the “dmesg ” keyword. So we are specifying the log files, especially error types. So this command has specified all the logs files of type “error”.

 

How to Monitor System Usage, Outages and Troubleshoot Linux Servers

As we know that Linux is very reliable and a great system administrator should always know the system’s behavior and its utilization at every moment of time. So if an administrator or a user wants to monitor its complete system then they have to do the following  

Similar Reads

Storage Space Utilization

Linux provides two commands which are used to inspect storage space utilization these are as follows:...

Memory and CPU Utilization

1. top: Linux Process Monitoring...

What Happened?

When there is any fault like power failure or hard disk failure it can be a planned or not planned (Unplanned) process, Then we can use Logs to determine what happened or the possibilities of issues that can occur....

Conclusion

In this article, we have learned different types of commands to monitor the Linux system we have learned about the log file “/var/log/message”. We also discuss the different commands to get all the generic logs that warn, failed, and error. We have done this for specific folders in the var/log/folder....