> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/logging/appsec2-aws-39.md).

# Domain Name System (DNS) query logging is not enabled for Amazon Route 53 hosted zones misconfigurat

## Rule Details

|                        |                               |
| ---------------------- | ----------------------------- |
| Cortex AppSec Rule ID  | APPSEC2\_AWS\_39              |
| Category - Subcategory | Logging - Disabled or missing |
| Provider               | AWS                           |
| Severity               | LOW                           |
| Framework              | Terraform, Terraform Plan     |

## Impact

This rule detects if DNS query logging is not enabled for Amazon Route 53 hosted zones.

## How to Fix

*Resource:* aws\_route53\_query\_logging\_config, aws\_route53\_zone

* *Arguments:* query\_logging\_config and zone\_id

To fix this issue, enable DNS query logging for the Route 53 hosted zones in your Terraform code. You can do this by adding the `query_logging_config` argument along with the corresponding `zone_id` argument to the `aws_route53_zone` resource block in your Terraform code.

Secure code example:

The above code enables DNS query logging for a Route 53 hosted zone by creating a `aws_route53_query_logging_config` resource and associating it with the corresponding `aws_route53_zone` resource. The `aws_cloudwatch_log_group` resource is created as well, providing a destination for the logged DNS queries.

## This configuration ensures that DNS query logging is enabled for the specified Route 53 hosted zone. \[source,go]

resource "aws\_route53\_query\_logging\_config" "example" { name = "example-logging-config" record\_type = "QUERY\_LOGGING" cloudwatch\_logs\_group\_arn = aws\_cloudwatch\_log\_group.example.arn }

resource "aws\_route53\_zone" "example" { name = "example.com." query\_logging\_config { id = aws\_route53\_query\_logging\_config.example.id region = "us-east-1" } }

## resource "aws\_cloudwatch\_log\_group" "example" { name = "example-logs" }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/logging/appsec2-aws-39.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
