What are server logs and what are they for?
Vladimir Lebedenko
I will help you build geo diversified and fault-tolerant server infrastructure for your business. DM me to learn how.
Server logs are files that record and store system information about the operation of the device. They contain data about certain events that occur on the server:
The nature of the contents of the logs depends on their location, purpose, and the settings set by the administrator.
Where can I see the server logs
As a rule, these files are stored on the hard disk or?SSD?of the main server, and most often it is the root directory of the hosting, the system folder logs. The exact location will depend on the operating system:
In general, it is not a problem to find web server logs, but not everyone can read and understand them correctly. Let's talk about this further.
Why watch server logs and how to read them correctly
The logs contain important information about?server?crashes, sudden increases in load, insufficient performance, and more. Here you can find indirect and direct indications of hacking attempts, spamming, etc. It is important to be able to properly analyze these files to take timely measures to improve the server and ensure a high level of security.
Every log has a clear structure with coded information about the nature of the incident. For example, let's look at the structure of a standard access_log file:
领英推荐
102.102.102.102 - - [02/Feb/2022:12:00:00 +0100] "GET /wp-includes/feed.php HTTP/2.0" 200 - "-" "Chrome/6.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"
Decipher:
The structure of log files will be different depending on the operating system, so there is no universal guide - you need to learn everything on an individual basis. For Windows Server everything is very simple - logging is done in the form of a table with a smart and convenient structure. All in all, a little bit of theory and practice, and you can easily read any server logs, from mail logs to boot logs.
Checking logs if you have a VPS server
To access the system logs, you first need to connect to the server via SSH, and then enter a sequence of commands into the console:
cd logs.ls -all.
The contents of the logs folder will appear in front of you, so all you have to do is to open the log file you are looking for and start analyzing it. To make it easier to collect and view server logs, many administrators use special software such as Paessler PRTG, Papertrail, Loggly or XpoLog. Here everyone prefers what is more convenient and cheaper, because the normal programs, as a rule, paid. This concludes my article and thank you for your attention. If you experience any difficulties, feel free to contact the HostZealot specialists. We can offer a?VPS?for rent and help you get started.