Know Linux log files

linux-drivers

The GNU/Linux operating system itself offers many possibilities and flexibility on its own , without the need for add-ons. But in most cases, users fail to take full advantage of its potential and instead use other tools that sometimes simply replicate the capabilities the system already offers natively. Well, today we're going to talk about logs. While a more in-depth look at this topic would require more than one article, we'll present some basic concepts and how they can help us in terms of technical aspects, security, and more.

You can access them simply by going to the system's /var/log directory , where you'll find a series of very interesting subdirectories and files containing valuable information. This includes everything from errors that can be used to detect and correct system or hardware problems, to other information such as system access logs, which can help detect, for example, intruders who have entered without your consent. In fact, these logs are often deleted or modified by attackers to avoid leaving any record or trace of their access.

What can we find in /var/log? Well, we can find a series of subdirectories such as:

  • / var / log / message: log of general system messages.
  • /var/log/auth.log: authentication log.
  • /var/log/kern.log: kernel log, very useful for detecting kernel problems.
  • /var/log/cron.log: crond tool log
  • / var / log / maillog: email server log.
  • / var / log / qmail: Qmail log.
  • / var / log / httpd: Apache web server access and error log
  • / var / log / lightpd - Lighttpd access and error log.
  • /var/log/boot.log: system boot log, if problems occur at startup, this is where we need to turn.
  • /var/log/mysqld.log: log for the MySQL database.
  • / var / log / secure: authentication log, very important for security, since you will be able to see what refers to the authentication of the system.
  • / var / log / utmp or / var / log / wtmp: log log.

For example , if you want to know if someone has authenticated on the system, you can see the dates and times of logins made remotely via SSH from the network, something that many attackers take advantage of if they have obtained your username and password to remotely penetrate the computer:

cd /var/log

grep sshd/var/log/auth.log | less

This filters SSH sessions, but you can use `cat` or a text editor to view the full log if you wish…


Add as preferred source in Google