Viewing function logs
All times in the log are UTC
- In the management console
, select the folder containing the function. - Select Cloud Functions.
- Click a function to view its runtime log.
- In the window that opens, go to Logs and specify the period for which you want to view logs. The default period is 1 hour.
When viewing the log, you can set a specific interval using the --since
and --until
flags. If no time interval is specified, information for the previous hour is displayed.
The following flags are used:
-
--since
: Time N and later. -
--until
: Time N and earlier.
If you only specify one flag, information is displayed for the hour before or after N depending on the flag.
Allowed time formats:
-
HH:MM:SS
. Example:15:04:05
. -
RFC-3339
. Example:2006-01-02T15:04:05Z
,2h
,3h30m ago
.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To find out the name or unique ID of a function, get a list of functions in the folder.
View the function execution log:
yc serverless function logs <function_name>
Result:
2019-07-04 09:27:43 START RequestID: 34dc9533-ed6e-4468-b9f2-2aa0******** Version: b09i2s85a0c1********
2019-07-04 09:27:43 END RequestID: 34dc9533-ed6e-4468-b9f2-2aa0********
2019-07-04 09:27:43 REPORT RequestID: 34dc9533-ed6e-4468-b9f2-2aa0******** Duration: 538.610 ms Billed Duration: 538.700 ms Memory Size: 128 MB Max Memory Used: 13 MB
2019-07-04 09:29:25 START RequestID: 5b6a3779-dcc8-44ec-8ee2-2e7f******** Version: b09i2s85a0c1********
2019-07-04 09:29:26 END RequestID: 5b6a3779-dcc8-44ec-8ee2-2e7f********
2019-07-04 09:29:26 REPORT RequestID: 5b6a3779-dcc8-44ec-8ee2-2e7f******** Duration: 554.904 ms Billed Duration: 555.000 ms Memory Size: 128 MB Max Memory Used: 13 MB
...
Note
If you called a function with a specific tag, you must also specify this tag when viewing the execution log: yc serverless function logs my-python-function --tag test
.
To learn more about working with logs, see the Yandex Cloud Logging documentation.