Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable to configure logging extent #435

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}