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 Object Storage
    • All tutorials
    • Getting statistics on object queries with S3 Select
    • Getting website traffic statistics with S3 Select
    • Getting statistics on object queries using Yandex Query
    • Generating a resource-by-resource cost breakdown report using S3 Select
    • Server-side encryption
    • Integrating an L7 load balancer with CDN and Object Storage
    • Blue-green and canary deployment of service versions
    • Analyzing logs in DataLens
    • Mounting buckets to the file system of Yandex Data Processing hosts
    • Using Object Storage in Yandex Data Processing
    • Importing data from Object Storage, processing and exporting to Managed Service for ClickHouse®
    • Mounting a bucket as a disk in Windows
    • Migrating data from Yandex Data Streams using Yandex Data Transfer
    • Using hybrid storage in Yandex Managed Service for ClickHouse®
    • Loading data from Yandex Managed Service for OpenSearch to Yandex Object Storage using Yandex Data Transfer
    • Automatically copying objects from one bucket to another
    • Recognizing audio files in a bucket on a regular basis
    • Training a model in Yandex DataSphere on data from Object Storage
    • Connecting to Object Storage from VPC
    • Migrating data to Yandex Managed Service for PostgreSQL using Yandex Data Transfer
    • Uploading data to Yandex Managed Service for Greenplum® using Yandex Data Transfer
    • Uploading data to Yandex Managed Service for ClickHouse® using Yandex Data Transfer
    • Uploading data to Yandex Managed Service for YDB using Yandex Data Transfer
    • Exchanging data between Yandex Managed Service for ClickHouse® and Yandex Data Processing
    • Uploading data from Yandex Managed Service for YDB using Yandex Data Transfer
    • Hosting a static Gatsby website in Object Storage
    • Migrating a database from Managed Service for PostgreSQL to Object Storage
    • Exchanging data between Yandex Managed Service for ClickHouse® and Yandex Data Processing
    • Importing data from Yandex Managed Service for PostgreSQL to Yandex Data Processing using Sqoop
    • Importing data from Yandex Managed Service for MySQL® to Yandex Data Processing using Sqoop
    • Migrating data from Yandex Object Storage to Yandex Managed Service for MySQL® using Yandex Data Transfer
    • Migrating a database from Yandex Managed Service for MySQL® to Yandex Object Storage
    • Exporting Greenplum® data to a cold storage in Yandex Object Storage
    • Loading data from Yandex Direct to a Yandex Managed Service for ClickHouse® data mart using Yandex Cloud Functions, Yandex Object Storage, and Yandex Data Transfer
    • Migrating data from Elasticsearch to Yandex Managed Service for OpenSearch
    • Uploading Terraform states to Object Storage
    • Locking Terraform states using Managed Service for YDB
    • Visualizing Yandex Query data
    • Publishing game updates
    • VM backups using Hystax Acura
    • Backing up to Object Storage with CloudBerry Desktop Backup
    • Backing up to Object Storage with Duplicati
    • Backing up to Object Storage with Bacula
    • Backing up to Yandex Object Storage with Veeam Backup
    • Backing up to Object Storage with Veritas Backup Exec
    • Managed Service for Kubernetes cluster backups in Object Storage
    • Developing a custom integration in API Gateway
    • URL shortener
    • Storing application runtime logs
    • Developing a skill for Alice and a website with authorization
    • Creating an interactive serverless application using WebSocket
    • Deploying a web application using the Java Servlet API
    • Developing a Telegram bot
    • Replicating logs to Object Storage using Fluent Bit
    • Replicating logs to Object Storage using Data Streams
    • Uploading audit logs to ArcSight SIEM
    • Exporting audit logs to SIEM Splunk systems
    • Creating an MLFlow server for logging experiments and artifacts
    • Operations with data using Yandex Query
    • Federated data queries using Query
    • Recognizing text in image archives using Vision OCR
    • Converting a video to a GIF in Python
    • Automating tasks using Managed Service for Apache Airflow™
    • Processing files with usage details in Yandex Cloud Billing
    • Deploying a web app with JWT authorization in API Gateway and authentication in Firebase
    • Searching for Yandex Cloud events in Yandex Query
    • Searching for Yandex Cloud events in Object Storage
    • Creating an external table from a bucket table using a configuration file
    • Migrating databases from Google BigQuery to Managed Service for ClickHouse®
  • 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. Getting statistics on object queries using Yandex Query

Getting statistics on queries to Object Storage objects using Yandex Query

Written by
Yandex Cloud
Updated at May 7, 2025
  • 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 in Yandex Cloud and create a billing account:

  1. Navigate to the management console and log in to Yandex Cloud or register 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 navigate to the cloud page to create or select a folder for your infrastructure to operate in.

Learn more about clouds and folders.

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. From the list of services, select Object Storage.
  3. At the top right, click Create bucket.
  4. In the ** Name** field, enter the bucket name: object-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. From the list of services, select Object Storage.

  3. Select object-bucket.

  4. Enable logging:

    1. In the left-hand panel, select Settings.
    2. Navigate to the Logging tab.
    3. Enable Write logs.
    4. In the Bucket for log storage field, select logs-bucket.
    5. Click Save.
  5. In the left-hand panel, select Objects and upload your objects. For example, you can upload 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 interface
  1. Go to Query.

  2. In the left-hand panel, select Connections.

  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 interface
  1. Go to Query.

  2. In the left-hand panel, select Connections.

  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
Getting website traffic statistics with S3 Select
Next
Generating a resource-by-resource cost breakdown report using S3 Select
© 2025 Direct Cursus Technology L.L.C.