Skip to content

Commit

Permalink
Add variable to configure logging extent
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtiomMatiom committed Oct 17, 2024
1 parent 5e3dad1 commit 656b0d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/azure/api_management_logging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ resource "azurerm_api_management_api_diagnostic" "diagnostic" {
api_name = each.key
api_management_logger_id = azurerm_api_management_logger.logger.id

sampling_percentage = 5.0
sampling_percentage = var.sampling_percentage
always_log_errors = true
log_client_ip = true
verbosity = "verbose"
http_correlation_protocol = "W3C"

frontend_request {
body_bytes = 32
body_bytes = var.log_payload_size
headers_to_log = [
"content-type",
"accept",
Expand All @@ -50,7 +50,7 @@ resource "azurerm_api_management_api_diagnostic" "diagnostic" {
}

frontend_response {
body_bytes = 32
body_bytes = var.log_payload_size
headers_to_log = [
"content-type",
"content-length",
Expand All @@ -59,7 +59,7 @@ resource "azurerm_api_management_api_diagnostic" "diagnostic" {
}

backend_request {
body_bytes = 32
body_bytes = var.log_payload_size
headers_to_log = [
"content-type",
"accept",
Expand All @@ -68,7 +68,7 @@ resource "azurerm_api_management_api_diagnostic" "diagnostic" {
}

backend_response {
body_bytes = 32
body_bytes = var.log_payload_size
headers_to_log = [
"content-type",
"content-length",
Expand Down
12 changes: 12 additions & 0 deletions modules/azure/api_management_logging/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ variable "api_names" {
type = set(string)
description = ""
}

variable "log_payload_size"{
type = number
description = "max payload side to log "
default = 32
}

variable "sampling_percentage" {
type = number
description = "% of requests to log"
default = 5
}

0 comments on commit 656b0d7

Please sign in to comment.