Help Center/ FunctionGraph/ User Guide/ Monitoring/ Logs/ Managing Function Logs
Updated on 2024-11-12 GMT+08:00

Managing Function Logs

FunctionGraph v1 supports log management by using AOM or LTS.

FunctionGraph v2 supports log management by using LTS only.

  • Using AOM to manage function logs

  • Using LTS to manage function logs
    Figure 1 Logs page

Using AOM to Manage Function Logs

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of the desired function.
  3. Choose Monitoring > Logs. On the displayed page, enter search criteria.

    • You can:

      1. Enter a keyword for exact search. A keyword is a word between two adjacent delimiters.

      2. Enter a keyword with wildcards for fuzzy match. Example: *ROR*, ERR*, or ER*OR.

      3. Enter a phrase for exact search. Example: Start to refresh alm Statistic.

      4. Use AND (&&) or OR (||) to combine keywords to search. Example: query&&logs or query||logs.

    • You can select Last 30 minutes, Last hour, Last day, and Custom (up to one month, for example, 2022/04/01 16:34:48–2022/05/01 16:34:48).
    • You can query logs by version.

  4. Click to search for logs.

    Figure 2 Querying logs

    The log query result contains time, request ID, invocation result, duration, memory, and version.

  5. Perform the following operations if needed:

    1. Search for logs by keyword.

    2. Filter logs by status: Error, Info, Error & Warning, and Error & Warning & Info.

    3. View logs in full screen.

    4. Download logs.

    Figure 3 Other operations

Using LTS to Manage Function Logs

You can enable LTS to better manage function logs. After you enable LTS, FunctionGraph automatically creates a log group starting with functiongraph. When you create a function, a log stream starting with the function name is generated.

You can also bind a log group and log stream to a function to store its invocation logs. For details, see Configuring a Log Group and Log Stream.

  • By default, 20 log streams are created, which cannot be customized. On the Logs tab page of the function, press F12 to find out the log stream ID of the query API, and then locate the corresponding log stream ID in LTS.

  • Deleting a function log group by mistake on the LTS console will not be detected by FunctionGraph, and the historical log data can no longer be retrieved. To use a log group, modify the function description and save the changes. A new log group will be created.
  1. Enable LTS.

    Enabling LTS in FunctionGraph v1: On the Logs tab page, click Enable LTS to Manage Function Logs.

    In FunctionGraph v1, you can switch back to AOM. In that case, AOM will take over LTS to manage function logs. You will be billed for logs generated on a pay-per-use basis.

    Enabling LTS in FunctionGraph v2: On the Logs tab page, click Enable LTS. Click OK. LTS is enabled successfully.

    In FunctionGraph v2, only LTS can be used to manage function logs.

  2. Set filter criteria.

    • Request List: Filter requests by request ID, result (success or failure), or cause (initialization failed, load failed, system error, timed out, out of memory, out of disk space, or code error).
    • Request Log: Filter logs by keyword, request ID, or instance ID.
    Table 1 Invocation result

    Result

    Description

    Execution successful

    Log printed when a function is successfully executed.

    Execution failed

    Log printed when a function fails to be executed due to invocation timeout, memory or disk threshold exceeded, or code errors.

    To view the logs about invocation timeout, select Invocation timed out from the drop-down list. The methods for viewing the other three types of logs are the same.

    Table 2 Cause analysis

    Cause

    Description

    Initialization failed

    Log printed when the function initialization fails.

    Load failed

    Log generated when the runtime fails to load your function file.

    System error

    Internal error.

    Invocation timed out

    Log printed when the function invocation period is longer than the preset limit.

    Memory threshold exceeded

    Log printed when the function memory size exceeds the preset limit.

    Disk threshold exceeded

    Log printed when the disk size exceeds the preset limit.

    Code error

    Log printed when a code error occurs.

    • You can view logs of the last hour, last day, last 3 days, or a custom time period.
    • To manage function logs, go to the LTS console.
    • Max. 10 MB logs can be retained for common instances during initialization. When this limit is reached, the latest logs replace the old ones.

Downloading Logs

  • Currently, logs can be downloaded only when you use AOM for log management.
  • FunctionGraph v1 allows you to manage function logs using AOM.
  • FunctionGraph v2 allows you to manage function logs using LTS, but does not support log download.
  1. Return to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the name of the desired function.
  3. Click Monitoring.
  4. On the Logs page, select a version and time range, and click Download Log.

    A maximum of 5000 logs can be downloaded at a time. When querying logs, select a proper time range to avoid log loss.