Skip to main content

SCF Log

Deprecated

Since v3.0.0, the SCF log feature has been deprecated. Please use the log search feature.

You can use the tcb fn log command to view the running logs of SCF.

Basic Usage

tcb fn log <functionName>

Usage Example:

# View app Function Invocation Logs
tcb fn log app

Command Parameters

By default, the CLI returns the latest 20 logs. You can use the following parameters to filter and paginate the results:

ParameterDescriptionRemarks
-e, --env-id <envId>Environment Id-
-q, --qualifier <qualifier>Function versionDefault $LATEST
-i, --reqId <reqId>Function request IdExact search
-l, --limit <limit>The length of returned dataOffset + Limit cannot exceed 10000
-o, --offset <offset>The offset of dataOffset + Limit cannot exceed 10000
--order <order>Sort orderOptional values: desc (descending), asc (ascending)
--orderBy <orderBy>Sort fieldSupported: function_name, duration, mem_usage, start_time
--startTime <startTime>Query start timeFormat: 2019-05-16 20:00:00, must be within 1 day of endTime
--endTime <endTime>Query end timeFormat: 2019-05-16 20:59:59, must be within 1 day of startTime
-e, --errorOnly return error-level logs-
-s, --successOnly return success-level logs-

Usage Example

# View the latest 2 logs
tcb fn log app -l 2

# View logs within a specified time range
tcb fn log app --startTime "2019-05-16 20:00:00" --endTime "2019-05-16 20:59:59"

# View only error-level logs
tcb fn log app -e

# Sort by execution time in descending order
tcb fn log app --orderBy duration --order desc

# Query logs for the specified request Id
tcb fn log app -i d451aac7-bf12-11e9-xxxx-525400697544

# View logs for the specified version
tcb fn log app -q 1

# View logs for the $LATEST version (default)
tcb fn log app -q '$LATEST'

Log Output Example

Request time: 2019-08-15 12:12:00
Function name: app
Billing time (ms): 100
Execution time (ms): 0.38
Invocation count: 1
Memory usage: 35.730 MB
Request Id: d451aac7-bf12-11e9-xxxx-525400697544
Call status: Success
Return result: {"Message":"","Time":"2019-08-15T04:12:00Z","TriggerName":"myTrigger","Type":"Timer"}
Log:
...

END RequestId: d451aac7-bf12-11e9-xxxx-525400697544
Report RequestId: d451aac7-bf12-11e9-xxxx-525400697544 Duration:0ms Memory:256MB MaxMemoryUsed:35.730469MB

Precautions

  • By default, returns the latest 20 logs
  • Offset + Limit cannot exceed 10000
  • The interval between startTime and endTime cannot exceed 1 day