Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Object Storage
    • All tutorials
      • Getting statistics on object queries with S3 Select
      • Getting website traffic statistics with S3 Select
      • Analyzing logs in DataLens
      • Getting statistics on object queries using Yandex Query
      • Storing application runtime logs
      • Searching for Yandex Cloud events in Object Storage
      • Uploading audit logs to ArcSight SIEM
      • Replicating logs to Object Storage using Fluent Bit
      • Replicating logs to Object Storage using Data Streams
      • Uploading audit logs to Splunk SIEM
      • Searching for Yandex Cloud events in Yandex Query
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Bucket logs
  • Release notes
  • FAQ

In this article:

  • Get your cloud ready
  • Required paid resources
  • Create a service account
  • Create buckets
  • Enable logging
  • Configure connections in Query
  • Get statistics on queries
  • Query examples
  • How to delete the resources you created
  1. Tutorials
  2. Log collection and analysis
  3. Getting statistics on object queries using Yandex Query

Getting statistics on queries to Object Storage objects using Yandex Query

Written by
Yandex Cloud
View in Markdown
  • Get your cloud ready
    • Required paid resources
    • Create a service account
  • Create buckets
  • Enable logging
  • Configure connections in Query
  • Get statistics on queries
    • Query examples
  • How to delete the resources you created

In this tutorial, you will learn how to get statistics on queries to Yandex Object Storage objects using Yandex Query. You will create a bucket and configure logging in Object Storage, set up a connection in Query, and get statistics using SQL queries.

To get statistics:

  1. Get your cloud ready.
  2. Create buckets.
  3. Enable logging.
  4. Configure connections in Query.
  5. Get statistics on queries.

If you no longer need the resources you created, delete them.

Get your cloud readyGet your cloud ready

Sign up for Yandex Cloud and create a billing account:

  1. Navigate to the management console and log in to Yandex Cloud or create a new account.
  2. On the Yandex Cloud Billing page, make sure you have a billing account linked and it has the ACTIVE or TRIAL_ACTIVE status. If you do not have a billing account, create one and link a cloud to it.

If you have an active billing account, you can create or select a folder for your infrastructure on the cloud page.

Learn more about clouds and folders here.

Required paid resourcesRequired paid resources

The infrastructure support cost includes:

  • Fee for data storage (see Yandex Object Storage pricing).
  • Fee for the amount of read data (see Yandex Query pricing).

Create a service accountCreate a service account

With a service account, Query will be able to send queries to Object Storage.

Create a service account named yq-sa and assign the storage.viewer and yq.editor roles to it.

Create bucketsCreate buckets

Create two buckets: object-bucket and logs-bucket. One bucket will serve as a data source, and the other, as a log storage.

To create a bucket:

Management console
  1. In the management console, select the folder where you want to create a bucket.
  2. Navigate to Object Storage.
  3. In the top panel, click Create bucket.
  4. In the ** Name** field, enter a name for the bucket.
  5. Click Create bucket.

Similarly, create a bucket named logs-bucket.

Enable loggingEnable logging

To get information on queries to objects, enable logging actions on the bucket:

Management console
  1. In the management console, select the folder where you created the bucket.

  2. Navigate to Object Storage.

  3. Select the bucket.

  4. Enable logging:

    1. Navigate to the Settings tab, then to Logging.
    2. Enable Write logs.
    3. In the Bucket for log storage field, select logs-bucket.
    4. Click Save.
  5. Navigate to the Objects tab and upload the objects. For example, a couple of simple text files.

Configure connections in QueryConfigure connections in Query

To get data from Object Storage, create a connection and binding:

Yandex Query UI
  1. Navigate to Yandex Query.

  2. Navigate to the Connections tab.

  3. Click Create new.

  4. Enter a name for the connection, e.g., bucket-logs-connection.

  5. Select the Object Storage connection type and specify the Connection type parameters.

  6. In the Bucket auth field, select Private and set these properties:

    • Cloud and Folder: Select the cloud and folder where you created your buckets.
    • Bucket: logs-bucket.
    • Service account: yq-sa.
  7. Click Check. After a successful test, click Create.

  8. Click Automatically fill settings for and select Object Storage Access Logs from the drop-down list.

    1. Enter a name for the binding, e.g., bucket-logs-binding.
    2. In the Path field, specify the path to the statistics within the bucket. If the statistics are stored in the bucket root directory, specify /.
    3. Click Preview to verify the settings are correct.
    4. Click Create to complete creating the binding.

Get statistics on queriesGet statistics on queries

Use a connection to create SQL queries and get statistics on queries to Object Storage objects:

Yandex Query UI
  1. Navigate to Yandex Query.

  2. Navigate to the Connections tab.

  3. Select bucket-logs-connection.

  4. In the editor on the right, enter this query:

    SELECT `timestamp`, request_id, handler, object_key, status, request_time
    FROM `bucket-logs-binding`
    LIMIT 100;
    

    This query will return 100 records of statistics on queries to Object Storage objects. You can remove the record limit and filter results using WHERE.

  5. Click Run and check the results.

Query examplesQuery examples

Searching for queries by response codeSearching for queries by response code

SELECT `timestamp`, request_id, handler, object_key, status, request_time
FROM `bucket-logs-binding`
WHERE status >= 400

Searching for long-running queriesSearching for long-running queries

SELECT `timestamp`, request_id, handler, object_key, status, request_time
FROM `bucket-logs-binding`
WHERE request_time >= 1000

Average query processing timeAverage query processing time

This tutorial features the AVG aggregate function.

SELECT AVG(request_time) AS `avg` FROM `bucket-logs-binding`

How to delete the resources you createdHow to delete the resources you created

To shut down the infrastructure and stop paying for the resources you created:

  1. Delete the binding.
  2. Delete the connection.
  3. Delete the objects from the buckets.
  4. Delete the buckets.

Was the article helpful?

Previous
Analyzing logs in DataLens
Next
Storing application runtime logs
© 2026 Direct Cursus Technology L.L.C.