Configuring a Log Group and Log Stream¶
Note
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¶
Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
Click the function to be configured to go to the function details page.
Choose Configuration > Log, and configure log collection according to Table 1.
¶ 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.
Click Save.
After the function is invoked, view logs in the specified log group and log stream.
Note
You can change the log stream if needed.
Viewing Function Logs¶
View function logs in the specified log group and log stream.
Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
Click the function to be configured to go to the function details page.
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.
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.