Azure API Management Logger

This page shows how to write Terraform and Azure Resource Manager for API Management Logger and write them securely.

azurerm_api_management_logger (Terraform)

The Logger in API Management can be configured in Terraform with the resource name azurerm_api_management_logger. The following sections describe 8 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource.tf#L1
resource "azurerm_api_management_logger" "apim-logger" {
  name                = var.res_name
  api_management_name = var.res_api_management_name
  resource_group_name = var.res_rg_name
  resource_id         = var.res_resource_id

main.tf#L1
resource "azurerm_api_management_logger" "module" {
  name                = var.apimlog_name
  resource_group_name = var.rg_name

  api_management_name = var.apimlog_apim_name

main.tf#L7
resource "azurerm_api_management_logger" "this" {
  api_management_name = var.api_management_name
  buffered            = var.buffered
  description         = var.description
  name                = var.name
  resource_group_name = var.resource_group_name
main.tf#L15
resource "azurerm_api_management_logger" "logger" {
  name                = var.api_management_logger_name
  api_management_name = var.api_management_name
  resource_group_name = var.resource_group_name
  resource_id         = var.application_insights_id

main.tf#L7
resource "azurerm_api_management_logger" "this" {
  api_management_name = var.api_management_name
  buffered            = var.buffered
  description         = var.description
  name                = var.name
  resource_group_name = var.resource_group_name
apima.tf#L13
resource "azurerm_api_management_logger" "apim_logger" {
  name                = var.api_management_logger_name
  api_management_name = var.api_management_name
  resource_group_name = var.resource_group_name
  resource_id         = var.app_insights_id

main.tf#L61
resource "azurerm_api_management_logger" "example" {
  name                = "example-apimlogger"
  resource_group_name = var.resource_group_name
  api_management_name = azurerm_api_management.example.name

  application_insights {
main.tf#L91
resource "azurerm_api_management_logger" "this" {
  count = var.application_insights_instrumentation_key != null ? 1 : 0

  name                = format("%s-logger", var.name)
  api_management_name = azurerm_api_management.this.name
  resource_group_name = var.resource_group_name

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Logger within an API Management Service.

Microsoft.ApiManagement/service/loggers (Azure Resource Manager)

The service/loggers in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/loggers. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

  • apiVersion required - string
  • name required - string

    Logger identifier. Must be unique in the API Management service instance.

  • properties required
      • credentials optional - string

        The name and SendRule connection string of the event hub for azureEventHub logger. Instrumentation key for applicationInsights logger.

      • description optional - string

        Logger description.

      • isBuffered optional - boolean

        Whether records are buffered in the logger before publishing. Default is assumed to be true.

      • loggerType required - string

        Logger type.

      • resourceId optional - string

        Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource).

  • type required - string

Frequently asked questions

What is Azure API Management Logger?

Azure API Management Logger is a resource for API Management of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure API Management Logger?

For Terraform, the avishekansible/AzureLandingZone, jessewilk/terraform and kevinhead/azurerm source code examples are useful. See the Terraform Example section for further details.