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:

  • Getting started
  • Getting query statistics
  1. Tutorials
  2. Log collection and analysis
  3. Getting statistics on object queries with S3 Select

Getting object query statistics using S3 Select

Written by
Yandex Cloud
Updated at April 18, 2025
View in Markdown
  • Getting started
  • Getting query statistics

Get the query statistics for Object Storage objects using the S3 Select query language.

Note

To get information on object queries, enable logging.

Getting startedGetting started

  1. Install and configure the AWS CLI.
  2. Download and install the jq utility.

Getting query statisticsGetting query statistics

Bash
  1. Run the query against Object Storage and save the output to a file:

    1. For convenience, save:

      • Name of the bucket storing the object with the logs, to a variable named $bucket:

        bucket=<bucket_name>
        
      • Key of the object containing the logs, to a variable named $key:

        key=<object_key>
        
      • S3 Select expression to request object data, to a variable named $query:

        query='<query_text>'
        

        Sample expressions:

        • Retrieving queries by response code:

          SELECT "timestamp", request_id, handler, object_key, status, request_time
          FROM S3Object
          WHERE status >= 400
          
        • Searching for long-running queries:

          SELECT "timestamp", request_id, handler, object_key, status, request_time
          FROM S3Object
          WHERE request_time >= 1000
          
        • Average time for processing queries (using the AVG aggregate function):

          SELECT AVG(request_time) AS "avg" FROM S3Object
          
    2. Run this command:

      aws --endpoint https://storage.yandexcloud.net s3api select-object-content \
        --bucket $bucket \
        --key $key \
        --expression "$query" \
        --expression-type 'SQL' \
        --input-serialization 'JSON={Type=LINES}' \
        --output-serialization 'JSON={}' \
        "output.json"
      
  2. If a query uses no aggregate functions, output the number of queries for each object key. To do this, run an aggregation query using jq:

    jq .object_key output.json | uniq -c | sort -nr
    

    Result:

    9 "path/logs/2021-02-10-22-02-25-199f57b5-5601-3210-5d9a-1apl1e5z6b4f"
    7 "path/logs/2021-01-28-11-40-11-580g57b5-9903-1108-6a7a-1ghj1e0e8b0f"
    3 "path/logs/2020-12-09-10-05-31-123f57b5-1853-4120-8d7a-5bcc1e9e9b4f"
    1 "path/logs/2020-12-09-08-11-10-123f57b5-1773-9310-1d2a-5bcc1e9e9b4f"
    1 "path/logs/2020-12-01-14-42-11-493f57b5-1093-4120-8d7a-5bcc1e9e9b4f"
    

Was the article helpful?

Previous
Backing up a Managed Service for Kubernetes cluster to Object Storage
Next
Getting website traffic statistics with S3 Select
© 2026 Direct Cursus Technology L.L.C.