create_query_logging_config Boto3 Docs 1.26.93 documentation

April 2024 ยท 6 minute read

Creates a configuration for DNS query logging. After you create a query logging configuration, Amazon Route 53 begins to publish log data to an Amazon CloudWatch Logs log group.

DNS query logs contain information about the queries that Route 53 receives for a specified public hosted zone, such as the following:

Before you create a query logging configuration, perform the following operations.

Note

If you create a query logging configuration using the Route 53 console, Route 53 performs these operations automatically.

For more information, see The confused deputy problem in the Amazon Web Services IAM User Guide .

Note

You can't use the CloudWatch console to create or edit a resource policy. You must use the CloudWatch API, one of the Amazon Web Services SDKs, or the CLI.

Log Streams and Edge Locations

When Route 53 finishes creating the configuration for DNS query logging, it does the following:

The name of each log stream is in the following format:

hosted zone ID/edge location code

The edge location code is a three-letter code and an arbitrarily assigned number, for example, DFW3. The three-letter code typically corresponds with the International Air Transport Association airport code for an airport near the edge location. (These abbreviations might change in the future.) For a list of edge locations, see "The Route 53 Global Network" on the Route 53 Product Details page.

Queries That Are Logged

Query logs contain only the queries that DNS resolvers forward to Route 53. If a DNS resolver has already cached the response to a query (such as the IP address for a load balancer for example.com), the resolver will continue to return the cached response. It doesn't forward another query to Route 53 until the TTL for the corresponding resource record set expires. Depending on how many DNS queries are submitted for a resource record set, and depending on the TTL for that resource record set, query logs might contain information about only one query out of every several thousand queries that are submitted to DNS. For more information about how DNS works, see Routing Internet Traffic to Your Website or Web Application in the Amazon Route 53 Developer Guide .

Log File Format

For a list of the values in each query log and the format of each value, see Logging DNS Queries in the Amazon Route 53 Developer Guide .

Pricing

For information about charges for query logs, see Amazon CloudWatch Pricing.

How to Stop Logging

If you want Route 53 to stop sending query logs to CloudWatch Logs, delete the query logging configuration. For more information, see DeleteQueryLoggingConfig.

See also: AWS API Documentation

Request Syntax

response = client.create_query_logging_config( HostedZoneId='string', CloudWatchLogsLogGroupArn='string' ) 
ParametersReturn type

dict

Returns

Response Syntax

{ 'QueryLoggingConfig': { 'Id': 'string', 'HostedZoneId': 'string', 'CloudWatchLogsLogGroupArn': 'string' }, 'Location': 'string' } 

Response Structure

Exceptions

ncG1vNJzZmian6m8dHrAppizp56WxLR6wqikaK5hZLGwr9SmnKeskam2sLqOmqeiZ2Fjf3d6mGxmq52Wmr%2BmusKeZqydoqu2pLHSaKmoraSagnR7wqWgnqakZLCzscCtnJippZq%2FuqvLqJ6goZ6crKS7zZ%2BgoGaYqbqt