If you want to query and analyze the execution logs of functions, you must enable the log query feature of Function Compute. This topic describes how to enable the log query feature in the Function Compute console.

Prerequisites

Log Service and Function Compute are activated.

Procedure

  1. Log on to the Function Compute console.
  2. In the upper-left corner of the page, select a region.
  3. In the left-side navigation pane, click Service/Function.
  4. Create a service.
    1. In the Create Function drop-down list, select Create Service.
    2. Set the following parameters, and then click Create.
      Parameter Description
      Service Name The name of the service.
      Bind Log Click Bind Log to enable the log query feature. Log Service creates a project named aliyun-fc-region ID-bb47c1e4-cdd4-5318-978e-d748952652c8 and a Logstore named function-log.
      Note If you bind logs for the first time, the Cloud Resource Access Authorization dialog box appears after you click Create. You must authorize Function Compute to use the role AliyunFCLogExecutionRole to access Log Service.

After you enable the log query feature, execution logs are immediately collected. Log Service creates dedicated projects and dedicated Logstores. The log index feature is also automatically enabled.

What to do next

After execution logs are collected, you can query, analyze, download, ship, transform the collected logs in the Log Service console. You can also configure alerts. For more information, see Common operations on logs of Alibaba Cloud services.