How to check error logs in Linux?

To view the error logs of a Linux system, you can use the following method:

  1. View kernel logs using the dmesg command.
  2. System log
  3. View system logs using the journalctl command.
  4. view system logs
  5. Common log files to check in the /var/log directory include:
  6. /var/log/syslog is the system log file.
  7. The log file for authentication is located at /var/log/auth.log.
  8. The kernel log file can be found at /var/log/kern.log.
  9. Error logs of Apache can be found in the file /var/log/apache2/error.log.
  10. Nginx error log file located at /var/log/nginx/error.log.
  11. error.log file in /var/log/mysql: MySQL error log file
  12. Universal log file located at /var/log/messages.
  13. You can use either the cat command or the less command to view the contents of the log file, for example:
  14. Display the contents of the syslog file at /var/log/syslog
  15. Depending on the specific application, review the application’s log files. Different applications may have different log file paths and naming conventions.
  16. For example, to view the error log file of Apache:
  17. View the error log for Apache2 located at /var/log/apache2/error.log.
  18. Viewing the error log file of Nginx:
  19. Display the contents of the error.log file in the Nginx directory.
bannerAds