Viewing function logs
All times in the log are UTC
- In the management console
, navigate to the folder containing the function. - Go to Cloud Functions.
- Click the function to view its execution log.
- In the window that opens, go to Logs and specify the period for which you want to view logs. The default period is one hour.
When viewing the log, you can set a specific time interval using the --since and --until flags. If you do not specify a time interval, the log will show info for the last hour.
Using flags:
-
--since: Time N and later. -
--until: Time N and earlier.
If you only specify a single flag, you will see info for one hour before or after time N, depending on the flag.
You can use one of these time formats:
-
HH:MM:SS, e.g.,15:04:05. -
RFC-3339
, e.g.,2006-01-02T15:04:05Z,2h, or3h30m ago.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To find out the name or ID of a function, get the 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, make sure to 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 this Yandex Cloud Logging article.