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
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Logging
  • Getting started
    • All guides
    • Adding records
    • Reading records
    • Managing rights to access log groups
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • FAQ
  1. Step-by-step guides
  2. Reading records

Reading records

Written by
Yandex Cloud
Updated at May 5, 2025

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?

Previous
Adding records
Next
Managing rights to access log groups
Yandex project
© 2025 Yandex.Cloud LLC