Viewing container logs
All times in the log are UTC
- In the management console
, select Serverless Containers. - Click the container to view its runtime log.
- Go to the Logs tab and specify the period to view the logs for. The default period is 1 hour.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
When viewing the log, you can set a specific time interval using the --since and --until parameters. If you do not specify a time interval, the log will show info for the last hour.
Using parameters:
-
--since: Time N and later. -
--until: Time N and earlier.
If you only specify a single parameter, you will see info for one hour before or after time N, depending on the parameter.
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.
To access a container, use its name or unique ID. To get them, get a list of containers in the folder.
View the container runtime log:
yc logging read --resource-ids=<container_ID>
Result:
2021-12-07 10:39:03 INFO START RequestID: 24ad08bd-10f7-4e76-9f08-b2b1********
2021-12-07 10:39:03 Hi, I'm inside
2021-12-07 10:39:03 runtime pid 76: exited with 0
...
2021-12-07 10:42:04 INFO END RequestID: 24ad08bd-10f7-4e76-9f08-b2b1********
Learn more about working with logs in the Yandex Cloud Logging documentation.