tencent cloud

Serverless Cloud Function

GetFunctionLogs

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-10-13 15:53:14

1. API Description

Domain name for API request: scf.intl.tencentcloudapi.com.

This API returns function running logs based on the specified log query conditions. This API is offline. To query the returned information of function request running, please use GetRequestStatus. To query function running logs, see Log Search Guide.

A maximum of 5 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: GetFunctionLogs.
Version Yes String Common Params. The value used for this API: 2018-04-16.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
FunctionName No String Function name.
-To ensure compatibility of the retrieve function execution log API GetFunctionLogs, the input parameter FunctionName remains an optional field, but it is recommended to fill in this parameter. Otherwise, log acquisition failure may occur.
- After associating a function with CLS, it is recommended to use the relevant CLS APIs (https://www.tencentcloud.com/document/product/614/16875?from_cn_redirect=1) to get the best log retrieval experience.
Offset No Integer Offset of the data. Offset + Limit cannot be greater than 10000.
Limit No Integer Length of the returned data. Offset + Limit cannot be greater than 10000.
Order No String Whether to sort logs in descending or ascending order. Available values: desc and asc.
OrderBy No String Sort logs by a certain field. The following fields are supported: function_name, duration, mem_usage, start_time
Filter No LogFilter Log filter criteria. It can be used to distinguish correct and error logs. filter.RetCode=not0 means only return error logs, filter.RetCode=is0 means only return correct logs. If not passed, all logs are returned.
Namespace No String Namespace of the function
Qualifier No String Function version
FunctionRequestId No String Request ID for executing the function
StartTime No Timestamp Specific date of the query, for example: 2017-05-16 20:00:00. It must differ from endtime by no more than one day.
EndTime No Timestamp Specific date of the query, for example: 2017-05-16 20:59:59. It must differ from startTime by no more than one day.
SearchContext No LogSearchContext This field is offline.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Total number of function logs
Data Array of FunctionLog Function log information
SearchContext LogSearchContext This field is offline.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Retrieve Function Execution Log

Retrieve function execution log

Input Example

https://scf.intl.tencentcloudapi.com/?Action=GetFunctionLogs
&FunctionName=<FunctionName>
&<Common request parameters>

Output Example

{
    "Response": {
        "TotalCount": 1,
        "Data": [
            {
                "MemUsage": 3174400,
                "RetCode": 1,
                "RetMsg": "Success",
                "Log": "",
                "BillDuration": 100,
                "InvokeFinished": 1,
                "RequestId": "bc309eaa-6d64-11e8-a7fe-5254000b4175",
                "StartTime": "2018-06-11 18:46:45",
                "Duration": 0.532,
                "FunctionName": "APITest",
                "Level": "",
                "Source": "",
                "RetryNum": 1
            }
        ],
        "SearchContext": {
            "Offset": "",
            "Limit": 0,
            "Keyword": "",
            "Type": ""
        },
        "RequestId": "e2571ff3-da04-4c53-8438-f58bf057ce4a"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.AuthFailure Login information verification failed. token verification failed.
FailedOperation.QueryError Failed to query.
FailedOperation.TopicNotExist Topic not found.
InternalError Internal error.
InternalError.ES ES error.
InternalError.Exception Internal service exception.
InternalError.SearchFailed Search failed
InternalError.System Internal system error.
InvalidParameter.Cls The log parameter is incorrect.
InvalidParameter.ParamError Function creation parameter passing exception.
InvalidParameter.Payload Invalid request parameters.
InvalidParameter.RoleCheck RoleCheck parameter error.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.DateTime Invalid DateTime input.
InvalidParameterValue.FunctionType FunctionType parameter error.
InvalidParameterValue.ImageType Invalid ImageType parameter value.
InvalidParameterValue.Offset Invalid offset.
InvalidParameterValue.Order Order input error.
InvalidParameterValue.OrderBy The OrderBy value does not conform to the specification. Fix it and try again. For example values, see the corresponding API documentation: https://www.tencentcloud.com/document/product/583/17235?from_cn_redirect=1
InvalidParameterValue.RetCode Invalid RetCode.
InvalidParameterValue.StartTimeOrEndTime Simultaneously specify the start date and end date.
LimitExceeded.Offset Offset exceeds the limit.
ResourceNotFound.Function Function does not exist.
ResourceNotFound.FunctionName Function does not exist.
ResourceNotFound.RoleCheck The Role does not exist.
UnauthorizedOperation.CAM CAM authentication failed.
UnsupportedOperation The operation is not supported.
UnsupportedOperation.NotSupportRegion Unsupported region.

Ajuda e Suporte

Esta página foi útil?

comentários