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.
Tutorials
    • All tutorials
    • Enabling a blue-green and canary deployment of web service versions
    • Automating image builds using Jenkins and Packer
    • Continuous deployment of containerized applications using GitLab
    • App testing with GitLab
    • Creating test VMs using GitLab CI
    • GitLab integration with Tracker
    • High-performance computing on preemptible VMs
    • Load testing a gRPC service
    • Fixed-load HTTPS testing with Phantom
    • Step-load HTTPS testing with Pandora
    • Scripted HTTP load testing with Pandora
    • Load testing using multiple agents
    • Migrating load testing results from OverLoad
    • Running external agents for load testing
    • JMeter load testing
    • Getting statistics on queries to Object Storage objects using Query
    • Getting the number of queries to Object Storage objects
    • Invoking load testing from GitLab CI
    • Comparing load test results
    • Deploying GitLab Runner on a Compute Cloud virtual machine

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. Development and testing
  2. Getting statistics on queries to Object Storage objects using Query

Getting statistics on queries to Yandex 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
JMeter load testing
Next
Getting the number of queries to Object Storage objects
© 2025 Direct Cursus Technology L.L.C.