Help Center/ FunctionGraph/ User Guide/ Configuring Functions/ Configuring a Log Group and Log Stream
Updated on 2023-11-06 GMT+08:00

Configuring a Log Group and Log Stream

This feature is supported only by FunctionGraph V2.

Introduction

You can bind a log group and log stream to a function to store its invocation logs. By default, the logs are stored in the log stream automatically created for the function. For details, see Using LTS to Manage Function Logs.

Prerequisites

You have created a log group and log stream on the LTS console.

Procedure

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the function to be configured to go to the function details page.
  3. Choose Configuration > Log, and configure log collection according to Table 1.
    Table 1 Log configuration parameters

    Parameter

    Description

    Collect Logs

    Enabled by default in FunctionGraph V2. This feature is unavailable for FunctionGraph V1.

    Log Group

    Select a log group for the function. The default log group functiongraph.log.group.xxx cannot be selected.

    By default, the log group (starting with functiongraph) automatically generated by FunctionGraph is selected.

    Log Stream

    Select a log stream in the specified log group.

    By default, the log stream (starting with the function name) automatically generated for the function is selected.

  4. Click Save.
  5. After the function is invoked, view logs in the specified log group and log stream.

    You can change the log stream if needed.

Viewing Function Logs

View function logs in the specified log group and log stream.

  1. Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the function to be configured to go to the function details page.
  3. Choose Monitoring > Logs and view the function logs.
    • As shown in Figure 1, logs of the function are generated in the specified log group and log stream.
    • If no custom log group and log stream are specified, the default log group (starting with functiongraph) and log stream are displayed.
      Figure 1 Viewing function logs
    • The following figure shows two successful requests. The request at the bottom took 13.100 ms, including the cold start time. The request at the top took only 1.671 ms, because no cold start was involved.
      Figure 2 Logs