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
| Flag | Required | Description | Default |
|---|---|---|---|
<functionName> | Yes | Function name | — |
--env-id <envId> | No | Environment ID | Current default environment |
-q, --qualifier <qualifier> | No | Function version | $LATEST |
-i, --reqId <reqId> | No | Request ID, exact match | — |
-l, --limit <limit> | No | Number of entries | 20 |
-o, --offset <offset> | No | Number of entries to skip | 0 |
--order <order> | No | Sort direction: desc, asc | — |
--orderBy <orderBy> | No | Sort field: function_name, duration, mem_usage, start_time | — |
--startTime <startTime> | No | Start time, format 2019-05-16 20:00:00 | — |
--endTime <endTime> | No | End time, format 2019-05-16 20:59:59 | — |
-e, --error | No | Return error logs only | — |
-s, --success | No | Return 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
offsetpluslimitmust not exceed 10000.- The interval between
startTimeandendTimemust not exceed one day. - New projects should use
tcb logs searchdirectly.