Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI Studio
    • Business tools
  • 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
    • Education and Science
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex API Gateway
  • Getting started
    • All guides
    • Creating an API gateway
      • Updating API gateways and their specifications
      • Adding a domain
      • Specifying a cloud network
      • Setting up variables
      • Setting up a canary release
      • Viewing monitoring charts
        • Viewing logs
        • Writing logs
      • Removing a domain
      • Migration to the ru-central1-d availability zone
      • Deleting an API gateway
    • Viewing operations with service resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Logging destination
  • Minimum logging level
  • Disabling logging
  • Command example
  • Logging destination
  • Minimum logging level
  • Disabling logging
  • Example
  1. Step-by-step guides
  2. Managing an API gateway
  3. Managing logs
  4. Writing logs

Writing to the execution log in API Gateway

Written by
Yandex Cloud
Updated at July 14, 2025
  • Logging destination
  • Minimum logging level
  • Disabling logging
  • Command example
  • Logging destination
  • Minimum logging level
  • Disabling logging
  • Example

Note

Logging is not free of charge. For more information, see the Yandex Cloud Logging documentation.

Management console
CLI
Terraform
API
  1. In the management console, navigate to the folder containing the API gateway.

  2. In the list of services, select API Gateway.

  3. Select the API gateway for which you want to configure logging.

  4. At the top of the page, click Edit.

  5. Under Logging:

    1. Enable Write logs.

    2. In the Destination field, select:

      • Folder: To write logs to the default log group for the folder containing the API gateway.
      • Log group: To write logs to a custom log group.

        Select the log group to write logs to or create a new one.

    3. Optionally, Select the minimum logging level.

  6. Click Save.

If you set the minimum logging level, logs of that level and higher will be written to the execution log. With no minimum logging level set, all API gateway logs will be written to the execution log.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

Logging destinationLogging destination

If a custom log group is not specified in the API gateway parameters or logging is not turned off, the API gateway automatically writes all logs to the default log group for the folder it resides in.

To write logs to a custom log group, provide the log group ID in the --log-group-id parameter when creating or updating an API gateway. The log group must reside in the same folder as the API gateway.

Minimum logging levelMinimum logging level

To set the minimum logging level, provide it in the --min-log-level parameter when creating or updating an API gateway.

If you set the minimum logging level, logs of that level and higher will be written to the execution log. With no minimum logging level set, all API gateway logs will be written to the execution log.

Disabling loggingDisabling logging

To disable logging, set the --no-logging parameter when creating or updating an API gateway.

Command exampleCommand example

To write logs to a custom log group, run this command:

yc serverless api-gateway update <API_gateway_name_or_ID> \
  --log-group-id <log_group_ID> \
  --min-log-level <minimum_logging_level>

Where:

  • --log-group-id: ID of the log group to write logs to.
  • --min-log-level: Minimum logging level. The available levels are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL. This is an optional parameter.

Result:

id: d5dr8k465604********
folder_id: b1g3f9i71bpm********
created_at: "2024-01-26T09:18:55.985Z"
name: example_gateway
status: ACTIVE
domain: d5dm1lba80md********.i9******.apigw.yandexcloud.net
log_group_id: ckgsh1kdbvj1********
connectivity: {}
log_options:
  log_group_id: e23u2vn449av********
  min_level: ERROR

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the relevant documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

Logging destinationLogging destination

If a custom log group is not specified in the API gateway parameters or logging is not turned off, the API gateway automatically writes all logs to the default log group for the folder it resides in.

To write logs to a custom log group, under log_options, provide the log group ID in the log_group_id parameter when creating or updating an API gateway. The log group must reside in the same folder as the API gateway.

Minimum logging levelMinimum logging level

To set the minimum logging level, provide it in the log_group_id parameter under log_options when creating or updating an API gateway.

If you set the minimum logging level, logs of that level and higher will be written to the execution log. With no minimum logging level set, all API gateway logs will be written to the execution log.

Disabling loggingDisabling logging

To disable logging, under log_options, set the disabled parameter to true when creating or updating an API gateway.

ExampleExample

To write logs to a custom log group:

  1. Open the Terraform configuration file and add the log_options section to the yandex_api_gateway resource description:

    Here is an example of the configuration file structure:

    resource "yandex_api_gateway" "<API_gateway_name>" {
      ...
      log_options {
        folder_id = "<folder_ID>"
        min_level = "<minimum_logging_level>"
      }
      ...
    }
    

    Where:

    • folder_id: Folder ID.
    • min_level: Minimum logging level. The available levels are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL. This is an optional parameter.

    For more information about yandex_api_gateway properties in Terraform, see this Terraform article.

  2. Check the configuration using this command:

    terraform validate
    

    If the configuration is correct, you will get this message:

    Success! The configuration is valid.
    
  3. Run this command:

    terraform plan
    

    The terminal will display a list of resources with their properties. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.

  4. Apply the changes:

    terraform apply
    
  5. Type yes and press Enter to confirm the changes.

To write to the execution log in Yandex API Gateway, use the update REST API method for the ApiGateway resource or the ApiGatewayService/Update gRPC API call.

Was the article helpful?

Previous
Viewing logs
Next
Removing a domain
© 2025 Direct Cursus Technology L.L.C.