Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Cloud Logging
  • Getting started
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • FAQ

In this article:

  • Getting started
  • Add records to the log group
  • View the records

Getting started with Cloud Logging

Written by
Yandex Cloud
Improved by
valner
Updated at May 5, 2025
  • Getting started
  • Add records to the log group
  • View the records

In this tutorial, you'll add records to a log group and then view them.

Getting startedGetting started

To get started in Yandex Cloud:

  1. Log in to the management console. If not signed up yet, navigate to the management console and follow the on-screen instructions.
  2. On the Yandex Cloud Billing page, make sure you have a billing account linked and its status is ACTIVE or TRIAL_ACTIVE. If you do not have a billing account yet, create one.
  3. If you do not have a folder yet, create one.

Add records to the log groupAdd records to the log group

CLI
API

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 add records to a log group, run this command:

  • Linux, MacOS:
    yc logging write \
      --group-name=default \
      --message="My message" \
      --level=INFO \
      --json-payload='{"request_id": "1234"}'
    
  • Windows (cmd):
    yc logging write ^
      --group-name=default ^
      --message="My message" ^
      --level=INFO ^
      --json-payload="{"request_id": "1234"}"
    
  • Windows (PowerShell):
    yc logging write `
      --group-name=default `
      --message="My message" `
      --level=INFO `
      --json-payload='"{ \"request_id\": \"1234\" }"'
    

Where:

  • --group-name: Name of the log group to add records to. If this parameter is not specified, records are added to the default log group in the current folder. You can also specify --group-id instead of --group-name.
  • --message: Message.
  • --level: Logging level.
  • --json-payload: Additional information in JSON format.

Note

You can skip the --group-name, --message, and --json-payload flags and specify only the parameter values, keeping the order, e.g., default "My message" '{"request_id": "1234"}'.

To add records to the log group, use the LogIngestionService/Write gRPC API call.

View the recordsView the records

The log time is UTC. You can filter records using the filer expression language.

Management console
CLI
API
SDK
  1. In the management console, select the folder containing your log group.
  2. Select Cloud Logging.
  3. Click the row with the log group you want to view.
  4. The page that opens will show the log group records.

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.

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 (you can skip the --since flag and specify the time directly).
  • --until: Time N and earlier.

If you only specify one flag, information is displayed for the hour before or after Time X depending on the flag.

Allowed time formats:

  • HH:MM:SS, e.g., 15:04:05.
  • RFC-3339. For example: 2006-01-02T15:04:05Z, 2h, 3h30m ago.

To access a log group, use its name or unique ID. To find them, get a list of log groups in the folder. If you do not specify the name or ID, the output will contain records from the default log group in the current folder. You can skip the --group-name and --group-id flags and specify the group name or ID directly.

You can limit the number of output records using the --limit flag. Acceptable values are from 1 to 1000.

To view the records in JSON format, run the command:

yc logging read --group-name=default --format=json

Result:

[
  {
    "uid": "488ece3c-75b8-4d35-95ac-2b49********",
    "resource": {},
    "timestamp": "2023-06-22T02:10:40Z",
    "ingested_at": "2023-06-22T08:49:15.716Z",
    "saved_at": "2023-06-22T08:49:16.176097Z",
    "level": "INFO",
    "message": "My message",
    "json_payload": {
      "request_id": "1234"
    }
  }
]

To read records as they appear, use the --follow flag:

yc logging read --group-name=default --follow

This command will display records from the most recent hour and will continue to return new records until you terminate it by pressing Ctrl + C. The --follow flag is incompatible with --since and --until.

To view log group records, use the LogReadingService/Read gRPC API call.

You can read records in Cloud Logging using the Yandex Cloud SDK implemented for different languages. Below are examples of using the Python SDK.

Locally

import os
import yandexcloud
import pprint
from yandex.cloud.logging.v1.log_reading_service_pb2 import ReadRequest
from yandex.cloud.logging.v1.log_reading_service_pb2 import Criteria
from yandex.cloud.logging.v1.log_reading_service_pb2_grpc import LogReadingServiceStub

def handler():
  cloud_logging_service = yandexcloud.SDK(iam_token=os.environ['iam']).client(LogReadingServiceStub)
  logs = {}
  criteria = Criteria(log_group_id='<log_group_ID>', resource_ids=['<resource_ID>'])
  read_request = ReadRequest(criteria=criteria)

  logs = cloud_logging_service.Read(read_request)
  return logs

pprint.pprint(handler())

Where:

  • log_group_id: ID of the log group.
  • resource_ids: ID of the resource, e.g., a Managed Service for Kubernetes cluster.

Yandex Cloud Functions

import yandexcloud
from yandex.cloud.logging.v1.log_reading_service_pb2 import ReadRequest
from yandex.cloud.logging.v1.log_reading_service_pb2 import Criteria
from yandex.cloud.logging.v1.log_reading_service_pb2_grpc import LogReadingServiceStub

def handler(event, context):
    cloud_logging_service = yandexcloud.SDK().client(LogReadingServiceStub)
    logs = {}
    criteria = Criteria(log_group_id='<log_group_ID>', resource_ids=['<resource_ID>'])
    read_request = ReadRequest(criteria=criteria)

    logs = cloud_logging_service.Read(read_request)
    return logs

Where:

  • log_group_id: ID of the log group.
  • resource_ids: ID of the resource, e.g., a Managed Service for Kubernetes cluster.

Function parameters:

  • Runtime environment: python38
  • Entry point: index.handler
  • Timeout: 3
  • Memory: 128 MB

Was the article helpful?

Next
All guides
© 2025 Direct Cursus Technology L.L.C.