Skip to main content

tcb fn log

View runtime logs of a cloud function.

Deprecated

tcb fn log is deprecated since CLI v3.0.0. Use log search instead.

Usage​

tcb fn log <functionName> [options]

The default returns the 20 most recent entries.

Flags​

FlagRequiredDescriptionDefault
<functionName>YesFunction name—
--env-id <envId>NoEnvironment IDCurrent default environment
-q, --qualifier <qualifier>NoFunction version$LATEST
-i, --reqId <reqId>NoRequest ID, exact match—
-l, --limit <limit>NoNumber of entries20
-o, --offset <offset>NoNumber of entries to skip0
--order <order>NoSort direction: desc, asc—
--orderBy <orderBy>NoSort field: function_name, duration, mem_usage, start_time—
--startTime <startTime>NoStart time, format 2019-05-16 20:00:00—
--endTime <endTime>NoEnd time, format 2019-05-16 20:59:59—
-e, --errorNoReturn error logs only—
-s, --successNoReturn successful logs only—

Examples​

# Show the 2 most recent entries
tcb fn log app -l 2

# Show entries in a time range
tcb fn log app --startTime "2019-05-16 20:00:00" --endTime "2019-05-16 20:59:59"

# Show error logs only
tcb fn log app -e

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

# Query by request ID
tcb fn log app -i d451aac7-bf12-11e9-xxxx-525400697544

# Show logs of a specific version
tcb fn log app -q 1

# Show logs of $LATEST (default)
tcb fn log app -q '$LATEST'

Response​

请求时间: 2019-08-15 12:12:00
函数名称: app
计费时间(ms): 100
运行时间(ms): 0.38
调用次数: 1
占用内存: 35.730 MB
请求 Id: d451aac7-bf12-11e9-xxxx-525400697544
调用状态: 成功
返回结果: {"Message":"","Time":"2019-08-15T04:12:00Z","TriggerName":"myTrigger","Type":"Timer"}
日志:
...

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

Notes​

  • offset plus limit must not exceed 10000.
  • The interval between startTime and endTime must not exceed one day.
  • New projects should use tcb logs search directly.