Introduction: How to find the cause of the bug easily and quickly when there are many errors in FaaS application and too many requests to call the log page?

I heard you had this problem too?

Wang is a programmer. Recently, he encountered a headache when using the FaaS (Function as a Service) Service. His FaaS application reported many errors, but there were too many requests to call the log page, so he could not easily and quickly find the cause of the bug.

For Wang, in the development, operation and maintenance to check their own application error was a common thing, before Wang can be in the server locally printed logs to check the keyword, you can check whether the logic is correct, and then check the error message in the execution environment, the root cause of the error was found. Now, when Wang deploys the application to the cloud and delivers the service to the FaaS service provider for execution, he can only rely on the log solution provided by the FaaS service provider to query relevant debugging information. Unlike debugging on the server, he can directly investigate the causes of related errors and repair them.

Because of this problem, Xiao Wang had to search a little bit with his eyes in dozens or hundreds of requests to call the log every day, and his eyes would become useless, so he started the self-help mode beyond endurance…

How do mainstream function computing products respond?

Wang compared the current domestic mainstream function computing products, and he found that these products have three common points in log level:

  1. All rely on their own log service system for log storage.
  2. Expose a request list page to the user, containing all logs for each request.
  3. You can jump to the log service for independent query, and multiple functions can be written to the same log repository

The above three common points seem normal, they all use their own mature log service as log storage system, in order to ensure log security but also provide a good query experience; Request-level logging also naturally isolates users and fits the event-driven nature of FaaS; However, both support jumping to the logging service product to which they are bound may be mixed. There is no problem in terms of comprehensiveness and accuracy, and the bound log service can serve as the source-of-truth of user business logs.

Unfortunately, when users are faced with a vast amount of log information, which is mixed with the information of multiple applications and the configuration information of cloud services, it undoubtedly increases the use cost, and it takes a long learning period to make good use of the function of self-service query. ErrorStack is the most important thing developers care about when they debug, but in logging services, they see more useless information.

What you need and what you see

Ali cloud function to help you locate the problem at a glance

Optimize user log query experience – Text-oriented log

In order to make users more comfortable to use, ali Cloud function computing (FC) launched a new log keyword search function in February this year, which has been launched on the whole network. Next, with a few examples, xiao Wang is how to use this function to quickly locate the request log and keep his eyes.

(1) Text-oriented logging

On the call log-keyword search page, developers can see a complete and detailed business log of the current function

(including function initialization and call logs), where the developer only cares about the text, function calculations help you get rid of other useless information in the logging service page.

(2) Support query and highlighting

Developers can customize the text they type when using keyword searches. Users in the image can directly enter the order number in the search box to query desired log information.

Screen Recording 2022-03-03 at 7.25.06pm.mov

(3) Support simple query statement association operation

The keyword query search box supports the use of fields such as AND, OR, AND NOT to link text (consistent with the syntax of the log service), providing users with the possibility of fine-grained search.

Screen Recording 2022-03-03 at 7.20.55pm.mov

(4) More friendly to custom Runtime

For runtime and Container that require a high degree of customization, text-oriented log display and keyword search are also supported. In this way, container startup logs are naturally displayed to users.

Taking the classic Python-flask framework of custom-Container as an example, you can see that containers are started and logs started by Python Flask Server are displayed on the console. Similarly, initializer and custom Runtime logs can be collected.

Try to open

In aliyun Function Calculation (FC) function details page, click Call Log to query the call record of the current function. You can view the contents of function call logs on the keyword search TAB.

Document links:

Help.aliyun.com/document\_d…

Ali Cloud Function Computing (FC) not only focuses on providing users with extremely high engineering efficiency, helping users reduce cost and improve efficiency, but also cares about whether users experience silky smoothness when using our products.

With the increase of service volume, users have more and more requests for logs. The combination of request list and keyword query in the function computing console can easily cover 100% of log requests from developers, enabling you to locate problems quickly and directly search for service logs.

(the author | wang Ao)

The original link

This article is the original content of Aliyun and shall not be reproduced without permission.