Error Logs in LINUX - Libbna/BLOG_SITE GitHub Wiki

LOGGING:

  • Logging is a must for today’s developers; that’s why we built Retrace with a built-in, centralized log management tool to enable you to collect all your log data in one place for streamlined monitoring and better insights. Retrace works out-of-the-box with your stack, including Linux, Azure, MySQL, Windows, AWS, Oracle, MongoDB, and more. And, it includes all the features you need in a log management tool (log tailing, full-text searching, structured logging, monitoring and alerting, etc.), plus it’s integrated with error tracking for a seamless experience.

LINUX LOGS:

  • Linux logs provide a timeline of events for the Linux operating system, applications, and system, and are a valuable troubleshooting tool when you encounter issues. Essentially, analysing log files is the first thing an administrator needs to do when an issue is discovered.
  • There are Linux logs for everything: system, kernel, package managers, boot processes, Xorg, Apache, MySQL. In this article, the topic will focus specifically on Linux system logs.

You can change to this directory using the "cd" command. You’ll need to be the root user to view or access log files on Linux or Unix-like operating systems.

HOW TO VIEW LINUX LOGS?

  • Linux logs can be viewed with the command cd/var/log, then by typing the command ls to see the logs stored under this directory.

  • One of the most important logs to view is the syslog, which logs everything but auth-related messages.

  • Issue the command var/log/syslog to view everything under the syslog, but zooming in on a specific issue will take a while, since this file tends to be long. You can use Shift+G to get to the end of the file, denoted by “END.”

  • You can also view logs via dmesg, which prints the kernel ring buffer. It prints everything and sends you to the end of the file.

  • Lastly, you can use the tail command to view log files. It is one of the handiest tools you can use, since it only shows the last part of the logs, where the problem usually lies. For this, use the command tail /var/log/syslog or tail -f /var/log/syslog. tail will continue watching the log file, and print out the next line written to the file, allowing you to follow what is written to syslog as it happens.