Set up logging and analyze performance
The guide in this checklist item will help you set up operations with logs and analyze performance.
Create a log group
-
In the management console
, select the folder where you want to create your log group. -
Open Cloud Logging.
-
Click Create group.
-
(Optional) Enter a name and description for the log group. The name format is as follows:
- It must be 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Set the log group record retention period.
-
Click Create group.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder through the --folder-name
or --folder-id
parameter.
Note
The record retention period can only be specified in hours, minutes, or seconds, e.g., 1h
or 1440m
.
To create a log group, run this command:
yc logging group create --name=group --retention-period=1h
--name
: Log group name.--retention-period
: Retention period for log group records. This is an optional parameter.
Result:
done (1s)
id: af3flf29t8**********
folder_id: aoek6qrs8t**********
cloud_id: aoegtvhtp8**********
created_at: "2021-06-24T09:56:38.970Z"
name: group
status: ACTIVE
retention_period: 3600s
You can create a custom log group using the create API method.
View charts
- In the management console
, select the folder containing your log group. - Open Cloud Logging.
- Select a log group.
- Go to the Monitoring tab.
- The following charts will open on the page:
- Records successfully ingested: Number of records delivered to the Cloud Logging system. Only user logs are counted.
- Records saved: Number of records saved to the Cloud Logging system. Service and user logs are counted.
- Records read: Number of records read.
- Records ingest errors: Number of errors when adding records.
- Records save lag: Difference between the time of record delivery and its saving to the Cloud Logging system.