Before you can query and analyze the execution logs of functions, you must enable the logging feature of Function Compute. This topic describes how to enable the logging feature in the Function Compute console.

Prerequisites

Function Compute is activated. For more information, see Activate Function Compute.

Procedure

Note Before you can use a RAM user to enable the logging feature, you must grant the required permissions to the RAM user. For more information, see RAM user authorization.
  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services & Functions.
  3. In the top navigation bar, select a region based on your business requirements.
  4. On the Services page, click Create Service.
  5. In the Create Service panel, set the parameters and click OK.
    The following table describes the parameters. For more information, see Create a Service.
    Notice The first time you enable the logging feature, a message appears after you click OK in the Create Service panel. You must authorize Function Compute to assume the AliyunFcDefaultRole role. This way, Function Compute can access Log Service. In the message, click Authorize Now and complete the authorization as prompted. Function Compute
    Parameter Description
    Service Name The name of the service.
    Logging Specifies whether to enable the logging feature.
    • Enable: If you select Enable, Log Service generates a project named aliyun-fc-region ID-**** and a Logstore named function-log in the corresponding region. Indexing is enabled for the Logstore.
    • Disable: If you select Disable, the execution logs of Function Compute are not delivered to Log Service.

What to do next

After Log Service collects execution logs, you can query, analyze, download, ship, and transform the logs in the Log Service console. You can also create alert rules for the logs. For more information, see Common operations on logs of Alibaba Cloud services.