View logs under Linux

Source: Internet
Author: User
Tags apache log

Linux development is often used in the log, this is very useful, can help us quickly locate the error, such as if we do lamp development, the page does not error, but also no debugging tools, we step by step wrong very good time, and this method is also very stupid, so it is very important to master the use of the log.

To view the log commands:

Cat

Tail-f

For example, we may often look at the Apache log, can quickly locate the error of the Web project, Apache log my default directory under Var/log/httpd/, there are two log files Access_log and error_log files, I am accustomed to

Cat Access_log

Cat Error_log

This allows you to view the log file, quickly navigate to the number of error lines, and then parse the error

In addition to these errors, there are some system logs

/var/log/message system startup information and error log, which is one of the most commonly used logs in red Hat Linux
/var/log/secure Security-related log information
/var/log/maillog message-related log information
/var/log/cron log information related to timed tasks
/var/log/spooler log information related to UUCP and news devices
/var/log/boot.log Daemon starts and stops related log messages

These principles are the same, anyway the general running software is a log file, you want to find the log, you can find its location to view, in order to save time can use this command to quickly find

Find/-name file name

Then the corresponding path will be listed.

Of course, you can also use tools or write shell scripts to analyze the log, because the log is generally many, only by our manual analysis of efficiency is very slow, and is very stupid method

View logs under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.