From 35ad49ac458b948ef8b04ffa79a7b74c16852361 Mon Sep 17 00:00:00 2001 From: Michal Pipal Date: Mon, 1 Jul 2024 15:05:33 +0200 Subject: [PATCH] Enabled extenstion of logging for APIM AB#20739 --- modules/azure/api_management/main.tf | 8 ++--- modules/azure/api_management/variables.tf | 36 ++++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/modules/azure/api_management/main.tf b/modules/azure/api_management/main.tf index d100b24a..a0e13245 100644 --- a/modules/azure/api_management/main.tf +++ b/modules/azure/api_management/main.tf @@ -100,22 +100,22 @@ resource "azurerm_api_management_diagnostic" "apim_diagnostic" { http_correlation_protocol = var.diagnostic_settings.http_correlation_protocol frontend_request { - body_bytes = 32 + body_bytes = var.diagnostic_settings.frontend_request_body_bytes headers_to_log = var.diagnostic_settings.headers_to_log_request } frontend_response { - body_bytes = 32 + body_bytes = var.diagnostic_settings.frontend_response_body_bytes headers_to_log = var.diagnostic_settings.headers_to_log_response } backend_request { - body_bytes = 32 + body_bytes = var.diagnostic_settings.backend_request_body_bytes headers_to_log = var.diagnostic_settings.headers_to_log_request } backend_response { - body_bytes = 32 + body_bytes = var.diagnostic_settings.backend_response_body_bytes headers_to_log = var.diagnostic_settings.headers_to_log_response } } diff --git a/modules/azure/api_management/variables.tf b/modules/azure/api_management/variables.tf index 107408c7..b10e2243 100644 --- a/modules/azure/api_management/variables.tf +++ b/modules/azure/api_management/variables.tf @@ -70,23 +70,31 @@ variable "api_management_logger_settings" { variable "diagnostic_settings" { type = object({ - sampling_percentage = number, - always_log_errors = bool, - log_client_ip = bool, - verbosity = string, # possible values: verbose, information, error - http_correlation_protocol = string, # possible values: None, Legacy, W3C - headers_to_log_request = list(string), - headers_to_log_response = list(string) + sampling_percentage = number, + always_log_errors = bool, + log_client_ip = bool, + verbosity = string, # possible values: verbose, information, error + http_correlation_protocol = string, # possible values: None, Legacy, W3C + headers_to_log_request = list(string), + headers_to_log_response = list(string), + frontend_request_body_bytes = number, + frontend_response_body_bytes = number, + backend_request_body_bytes = number, + backend_response_body_bytes = number }) description = "Settings for api management diagnostic, api-management-diagnostic will be created only if api_management_logger_settings have been provided. " default = { - sampling_percentage = 5.0, - always_log_errors = true, - log_client_ip = true, - verbosity = "verbose", # possible values: verbose, information, error - http_correlation_protocol = "W3C", - headers_to_log_request = ["content-type", "accept", "origin"], - headers_to_log_response = ["content-type", "content-length", "origin"] + sampling_percentage = 5.0, + always_log_errors = true, + log_client_ip = true, + verbosity = "verbose", # possible values: verbose, information, error + http_correlation_protocol = "W3C", + headers_to_log_request = ["content-type", "accept", "origin"], + headers_to_log_response = ["content-type", "content-length", "origin"], + frontend_request_body_bytes = 32, + frontend_response_body_bytes = 32, + backend_request_body_bytes = 32, + backend_response_body_bytes = 32 } }