AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.
Enables the specified LoggingConfiguration , to start logging from a web ACL, according to the configuration provided.
This operation completely replaces any mutable specifications that you already have for a logging configuration with the ones that you provide to this call.
To modify an existing logging configuration, do the following:
You can access information about the traffic that WAF inspects using the following steps:
aws-waf-logs-
. Depending on the type of destination, you might need to configure additional settings or permissions. For configuration requirements and pricing information for each destination type, see Logging web ACL traffic in the WAF Developer Guide .PutLoggingConfiguration
request.When you successfully enable logging using a PutLoggingConfiguration
request, WAF creates an additional role or policy that is required to write logs to the logging destination. For an Amazon CloudWatch Logs log group, WAF creates a resource policy on the log group. For an Amazon S3 bucket, WAF creates a bucket policy. For an Amazon Kinesis Data Firehose, WAF creates a service-linked role.
For additional information about web ACL logging, see Logging web ACL traffic information in the WAF Developer Guide .
See also: AWS API Documentation
put-logging-configuration
--logging-configuration <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
--logging-configuration
(structure)
ResourceArn -> (string)
The Amazon Resource Name (ARN) of the web ACL that you want to associate withLogDestinationConfigs
.LogDestinationConfigs -> (list)
The logging destination configuration that you want to associate with the web ACL.
Note
You can associate one logging destination to a web ACL.(string)
RedactedFields -> (list)
The parts of the request that you want to keep out of the logs.
For example, if you redact the
SingleHeader
field, theHEADER
field in the logs will beREDACTED
for all rules that use theSingleHeader
FieldToMatch
setting.Redaction applies only to the component that's specified in the rule's
FieldToMatch
setting, so theSingleHeader
redaction doesn't apply to rules that use theHeaders
FieldToMatch
.Note
You can specify only the following fields for redaction:UriPath
,QueryString
,SingleHeader
, andMethod
.Note
This setting has no impact on request sampling. With request sampling, the only way to exclude fields is by disabling sampling in the web ACL visibility configuration.(structure)
Specifies a web request component to be used in a rule match statement or in a logging configuration.
- In a rule statement, this is the part of the web request that you want WAF to inspect. Include the single
FieldToMatch
type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component inFieldToMatch
for each rule statement that requires it. To inspect more than one component of the web request, create a separate rule statement for each component. Example JSON for aQueryString
field to match:"FieldToMatch": { "QueryString": {} }
Example JSON for aMethod
field to match specification:"FieldToMatch": { "Method": { "Name": "DELETE" } }
- In a logging configuration, this is used in the
RedactedFields
property to specify a field to redact from the logging records. For this use case, note the following:
- Even though all
FieldToMatch
settings are available, the only valid settings for field redaction areUriPath
,QueryString
,SingleHeader
, andMethod
.- In this documentation, the descriptions of the individual fields talk about specifying the web request component to inspect, but for field redaction, you are specifying the component type to redact from the logs.
- If you have request sampling enabled, the redacted fields configuration for logging has no impact on sampling. The only way to exclude fields from request sampling is by disabling sampling in the web ACL visibility configuration.
SingleHeader -> (structure)
Inspect a single header. Provide the name of the header to inspect, for example,
User-Agent
orReferer
. This setting isn't case sensitive.Example JSON:
"SingleHeader": { "Name": "haystack" }
Alternately, you can filter and inspect all headers with the
Headers
FieldToMatch
setting.Name -> (string)
The name of the query header to inspect.SingleQueryArgument -> (structure)
Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn't case sensitive.
Example JSON:
"SingleQueryArgument": { "Name": "myArgument" }
Name -> (string)
The name of the query argument to inspect.AllQueryArguments -> (structure)
Inspect all query arguments.UriPath -> (structure)
Inspect the request URI path. This is the part of the web request that identifies a resource, for example,/images/daily-ad.jpg
.QueryString -> (structure)
Inspect the query string. This is the part of a URL that appears after a?
character, if any.Body -> (structure)
Inspect the request body as plain text. The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.For information about how to handle oversized request bodies, see the
Body
object configuration.OversizeHandling -> (string)
What WAF should do if the body is larger than WAF can inspect.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.The options for oversize handling are the following:
CONTINUE
- Inspect the available body contents normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.You can combine the
MATCH
orNO_MATCH
settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.Default:
CONTINUE
Method -> (structure)
Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.JsonBody -> (structure)
Inspect the request body as JSON. The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.For information about how to handle oversized request bodies, see the
JsonBody
object configuration.MatchPattern -> (structure)
The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule inspection criteria.
All -> (structure)
Match all of the elements. See also
MatchScope
in JsonBody .You must specify either this setting or the
IncludedPaths
setting, but not both.IncludedPaths -> (list)
Match only the specified include paths. See also
MatchScope
in JsonBody .Provide the include paths using JSON Pointer syntax. For example,
"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer .You must specify either this setting or the
All
setting, but not both.Note
Don't use this option to include all paths. Instead, use theAll
setting.(string)
MatchScope -> (string)
The parts of the JSON to match against using the
MatchPattern
. If you specifyALL
, WAF matches against keys and values.All
does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logicalAND
statement to combine two match rules, one that inspects the keys and another that inspects the values.InvalidFallbackBehavior -> (string)
What WAF should do if it fails to completely parse the JSON body. The options are the following:
EVALUATE_AS_STRING
- Inspect the body as plain text. WAF applies the text transformations and inspection criteria that you defined for the JSON inspection to the body text string.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.If you don't provide this setting, WAF parses and evaluates the content only up to the first parsing failure that it encounters.
Note
WAF parsing doesn't fully validate the input JSON string, so parsing can succeed even for invalid JSON. When parsing succeeds, WAF doesn't apply the fallback behavior. For more information, see JSON body in the WAF Developer Guide .OversizeHandling -> (string)
What WAF should do if the body is larger than WAF can inspect.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.The options for oversize handling are the following:
CONTINUE
- Inspect the available body contents normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.You can combine the
MATCH
orNO_MATCH
settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.Default:
CONTINUE
Headers -> (structure)
Inspect the request headers. You must configure scope and pattern matching filters in the
Headers
object, to define the set of headers to and the parts of the headers that WAF inspects.Only the first 8 KB (8192 bytes) of a request's headers and only the first 200 headers are forwarded to WAF for inspection by the underlying host service. You must configure how to handle any oversize header content in the
Headers
object. WAF applies the pattern matching filters to the headers that it receives from the underlying host service.MatchPattern -> (structure)
The filter to use to identify the subset of headers to inspect in a web request.
You must specify exactly one setting: either
All
,IncludedHeaders
, orExcludedHeaders
.Example JSON:
"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }
All -> (structure)
Inspect all headers.IncludedHeaders -> (list)
Inspect only the headers that have a key that matches one of the strings specified here.
(string)
ExcludedHeaders -> (list)
Inspect only the headers whose keys don't match any of the strings specified here.
(string)
MatchScope -> (string)
The parts of the headers to match with the rule inspection criteria. If you specify
ALL
, WAF inspects both keys and values.All
does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logicalAND
statement to combine two match rules, one that inspects the keys and another that inspects the values.OversizeHandling -> (string)
What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.
The options for oversize handling are the following:
CONTINUE
- Inspect the available headers normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.Cookies -> (structure)
Inspect the request cookies. You must configure scope and pattern matching filters in the
Cookies
object, to define the set of cookies and the parts of the cookies that WAF inspects.Only the first 8 KB (8192 bytes) of a request's cookies and only the first 200 cookies are forwarded to WAF for inspection by the underlying host service. You must configure how to handle any oversize cookie content in the
Cookies
object. WAF applies the pattern matching filters to the cookies that it receives from the underlying host service.MatchPattern -> (structure)
The filter to use to identify the subset of cookies to inspect in a web request.
You must specify exactly one setting: either
All
,IncludedCookies
, orExcludedCookies
.Example JSON:
"MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }
All -> (structure)
Inspect all cookies.IncludedCookies -> (list)
Inspect only the cookies that have a key that matches one of the strings specified here.
(string)
ExcludedCookies -> (list)
Inspect only the cookies whose keys don't match any of the strings specified here.
(string)
MatchScope -> (string)
The parts of the cookies to inspect with the rule inspection criteria. If you specify
ALL
, WAF inspects both keys and values.All
does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logicalAND
statement to combine two match rules, one that inspects the keys and another that inspects the values.OversizeHandling -> (string)
What WAF should do if the cookies of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request cookies when they exceed 8 KB (8192 bytes) or 200 total cookies. The underlying host service forwards a maximum of 200 cookies and at most 8 KB of cookie contents to WAF.
The options for oversize handling are the following:
CONTINUE
- Inspect the available cookies normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.HeaderOrder -> (structure)
Inspect a string containing the list of the request's header names, ordered as they appear in the web request that WAF receives for inspection. WAF generates the string and then uses that as the field to match component in its inspection. WAF separates the header names in the string using colons and no added spaces, for example
host:user-agent:accept:authorization:referer
.OversizeHandling -> (string)
What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.
The options for oversize handling are the following:
CONTINUE
- Inspect the available headers normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.JA3Fingerprint -> (structure)
Available for use with Amazon CloudFront distributions and Application Load Balancers. Match against the request's JA3 fingerprint. The JA3 fingerprint is a 32-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client's TLS configuration. WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. Almost all web requests include this information.
Note
You can use this choice only with a string matchByteMatchStatement
with thePositionalConstraint
set toEXACTLY
.You can obtain the JA3 fingerprint for client requests from the web ACL logs. If WAF is able to calculate the fingerprint, it includes it in the logs. For information about the logging fields, see Log fields in the WAF Developer Guide .
Provide the JA3 fingerprint string from the logs in your string match statement specification, to match with any future requests that have the same TLS configuration.
FallbackBehavior -> (string)
The match status to assign to the web request if the request doesn't have a JA3 fingerprint.
You can specify the following fallback behaviors:
MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.ManagedByFirewallManager -> (boolean)
Indicates whether the logging configuration was created by Firewall Manager, as part of an WAF policy configuration. If true, only Firewall Manager can modify or delete the configuration.LoggingFilter -> (structure)
Filtering that specifies which web requests are kept in the logs and which are dropped. You can filter on the rule action and on the web request labels that were applied by matching rules during web ACL evaluation.
Filters -> (list)
The filters that you want to apply to the logs.
(structure)
A single logging filter, used in LoggingFilter .
Behavior -> (string)
How to handle logs that satisfy the filter's conditions and requirement.Requirement -> (string)
Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.Conditions -> (list)
Match conditions for the filter.
(structure)
A single match condition for a Filter .
ActionCondition -> (structure)
A single action condition. This is the action setting that a log record must contain in order to meet the condition.
Action -> (string)
The action setting that a log record must contain in order to meet the condition. This is the action that WAF applied to the web request.
For rule groups, this is either the configured rule action setting, or if you've applied a rule action override to the rule, it's the override action. The value
EXCLUDED_AS_COUNT
matches on excluded rules and also on rules that have a rule action override of Count.LabelNameCondition -> (structure)
A single label name condition. This is the fully qualified label name that a log record must contain in order to meet the condition. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label.
LabelName -> (string)
The label name that a log record must contain in order to meet the condition. This must be a fully qualified label name. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label.DefaultBehavior -> (string)
Default handling for logs that don't match any of the specified filtering conditions.LogType -> (string)
Used to distinguish between various logging options. Currently, there is one option.
Default:
WAF_LOGS
LogScope -> (string)
The owner of the logging configuration, which must be set to
CUSTOMER
for the configurations that you manage.The log scope
SECURITY_LAKE
indicates a configuration that is managed through Amazon Security Lake. You can use Security Lake to collect log and event data from various sources for normalization, analysis, and management. For information, see Collecting data from Amazon Web Services services in the Amazon Security Lake user guide .Default:
CUSTOMER
JSON Syntax:
{
"ResourceArn": "string",
"LogDestinationConfigs": ["string", ...],
"RedactedFields": [
{
"SingleHeader": {
"Name": "string"
},
"SingleQueryArgument": {
"Name": "string"
},
"AllQueryArguments": {
},
"UriPath": {
},
"QueryString": {
},
"Body": {
"OversizeHandling": "CONTINUE"|"MATCH"|"NO_MATCH"
},
"Method": {
},
"JsonBody": {
"MatchPattern": {
"All": {
},
"IncludedPaths": ["string", ...]
},
"MatchScope": "ALL"|"KEY"|"VALUE",
"InvalidFallbackBehavior": "MATCH"|"NO_MATCH"|"EVALUATE_AS_STRING",
"OversizeHandling": "CONTINUE"|"MATCH"|"NO_MATCH"
},
"Headers": {
"MatchPattern": {
"All": {
},
"IncludedHeaders": ["string", ...],
"ExcludedHeaders": ["string", ...]
},
"MatchScope": "ALL"|"KEY"|"VALUE",
"OversizeHandling": "CONTINUE"|"MATCH"|"NO_MATCH"
},
"Cookies": {
"MatchPattern": {
"All": {
},
"IncludedCookies": ["string", ...],
"ExcludedCookies": ["string", ...]
},
"MatchScope": "ALL"|"KEY"|"VALUE",
"OversizeHandling": "CONTINUE"|"MATCH"|"NO_MATCH"
},
"HeaderOrder": {
"OversizeHandling": "CONTINUE"|"MATCH"|"NO_MATCH"
},
"JA3Fingerprint": {
"FallbackBehavior": "MATCH"|"NO_MATCH"
}
}
...
],
"ManagedByFirewallManager": true|false,
"LoggingFilter": {
"Filters": [
{
"Behavior": "KEEP"|"DROP",
"Requirement": "MEETS_ALL"|"MEETS_ANY",
"Conditions": [
{
"ActionCondition": {
"Action": "ALLOW"|"BLOCK"|"COUNT"|"CAPTCHA"|"CHALLENGE"|"EXCLUDED_AS_COUNT"
},
"LabelNameCondition": {
"LabelName": "string"
}
}
...
]
}
...
],
"DefaultBehavior": "KEEP"|"DROP"
},
"LogType": "WAF_LOGS",
"LogScope": "CUSTOMER"|"SECURITY_LAKE"
}
--cli-input-json
(string)
Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
--debug
(boolean)
Turn on debug logging.
--endpoint-url
(string)
Override command's default URL with the given URL.
--no-verify-ssl
(boolean)
By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.
--no-paginate
(boolean)
Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.
--output
(string)
The formatting style for command output.
--query
(string)
A JMESPath query to use in filtering the response data.
--profile
(string)
Use a specific profile from your credential file.
--region
(string)
The region to use. Overrides config/env settings.
--version
(string)
Display the version of this tool.
--color
(string)
Turn on/off color output.
--no-sign-request
(boolean)
Do not sign requests. Credentials will not be loaded if this argument is provided.
--ca-bundle
(string)
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.
--cli-read-timeout
(int)
The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.
--cli-connect-timeout
(int)
The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.
To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.
Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal's quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .
To add a logging configuration to a web ACL
The following put-logging-configuration
adds the Amazon Kinesis Data Firehose logging configuration aws-waf-logs-custom-transformation
to the specified web ACL, with no fields redacted from the logs.
aws wafv2 put-logging-configuration \
--logging-configuration ResourceArn=arn:aws:wafv2:us-west-2:123456789012:regional/webacl/test-cli/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111,LogDestinationConfigs=arn:aws:firehose:us-west-2:123456789012:deliverystream/aws-waf-logs-custom-transformation \
--region us-west-2
Output:
{
"LoggingConfiguration":{
"ResourceArn":"arn:aws:wafv2:us-west-2:123456789012:regional/webacl/test-cli/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
"LogDestinationConfigs":[
"arn:aws:firehose:us-west-2:123456789012:deliverystream/aws-waf-logs-custom-transformation"
]
}
}
For more information, see Logging Web ACL Traffic Information in the AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide.
LoggingConfiguration -> (structure)
ResourceArn -> (string)
The Amazon Resource Name (ARN) of the web ACL that you want to associate withLogDestinationConfigs
.LogDestinationConfigs -> (list)
The logging destination configuration that you want to associate with the web ACL.
Note
You can associate one logging destination to a web ACL.(string)
RedactedFields -> (list)
The parts of the request that you want to keep out of the logs.
For example, if you redact the
SingleHeader
field, theHEADER
field in the logs will beREDACTED
for all rules that use theSingleHeader
FieldToMatch
setting.Redaction applies only to the component that's specified in the rule's
FieldToMatch
setting, so theSingleHeader
redaction doesn't apply to rules that use theHeaders
FieldToMatch
.Note
You can specify only the following fields for redaction:UriPath
,QueryString
,SingleHeader
, andMethod
.Note
This setting has no impact on request sampling. With request sampling, the only way to exclude fields is by disabling sampling in the web ACL visibility configuration.(structure)
Specifies a web request component to be used in a rule match statement or in a logging configuration.
- In a rule statement, this is the part of the web request that you want WAF to inspect. Include the single
FieldToMatch
type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component inFieldToMatch
for each rule statement that requires it. To inspect more than one component of the web request, create a separate rule statement for each component. Example JSON for aQueryString
field to match:"FieldToMatch": { "QueryString": {} }
Example JSON for aMethod
field to match specification:"FieldToMatch": { "Method": { "Name": "DELETE" } }
- In a logging configuration, this is used in the
RedactedFields
property to specify a field to redact from the logging records. For this use case, note the following:
- Even though all
FieldToMatch
settings are available, the only valid settings for field redaction areUriPath
,QueryString
,SingleHeader
, andMethod
.- In this documentation, the descriptions of the individual fields talk about specifying the web request component to inspect, but for field redaction, you are specifying the component type to redact from the logs.
- If you have request sampling enabled, the redacted fields configuration for logging has no impact on sampling. The only way to exclude fields from request sampling is by disabling sampling in the web ACL visibility configuration.
SingleHeader -> (structure)
Inspect a single header. Provide the name of the header to inspect, for example,
User-Agent
orReferer
. This setting isn't case sensitive.Example JSON:
"SingleHeader": { "Name": "haystack" }
Alternately, you can filter and inspect all headers with the
Headers
FieldToMatch
setting.Name -> (string)
The name of the query header to inspect.SingleQueryArgument -> (structure)
Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn't case sensitive.
Example JSON:
"SingleQueryArgument": { "Name": "myArgument" }
Name -> (string)
The name of the query argument to inspect.AllQueryArguments -> (structure)
Inspect all query arguments.UriPath -> (structure)
Inspect the request URI path. This is the part of the web request that identifies a resource, for example,/images/daily-ad.jpg
.QueryString -> (structure)
Inspect the query string. This is the part of a URL that appears after a?
character, if any.Body -> (structure)
Inspect the request body as plain text. The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.For information about how to handle oversized request bodies, see the
Body
object configuration.OversizeHandling -> (string)
What WAF should do if the body is larger than WAF can inspect.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.The options for oversize handling are the following:
CONTINUE
- Inspect the available body contents normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.You can combine the
MATCH
orNO_MATCH
settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.Default:
CONTINUE
Method -> (structure)
Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.JsonBody -> (structure)
Inspect the request body as JSON. The request body immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.For information about how to handle oversized request bodies, see the
JsonBody
object configuration.MatchPattern -> (structure)
The patterns to look for in the JSON body. WAF inspects the results of these pattern matches against the rule inspection criteria.
All -> (structure)
Match all of the elements. See also
MatchScope
in JsonBody .You must specify either this setting or the
IncludedPaths
setting, but not both.IncludedPaths -> (list)
Match only the specified include paths. See also
MatchScope
in JsonBody .Provide the include paths using JSON Pointer syntax. For example,
"IncludedPaths": ["/dogs/0/name", "/dogs/1/name"]
. For information about this syntax, see the Internet Engineering Task Force (IETF) documentation JavaScript Object Notation (JSON) Pointer .You must specify either this setting or the
All
setting, but not both.Note
Don't use this option to include all paths. Instead, use theAll
setting.(string)
MatchScope -> (string)
The parts of the JSON to match against using the
MatchPattern
. If you specifyALL
, WAF matches against keys and values.All
does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logicalAND
statement to combine two match rules, one that inspects the keys and another that inspects the values.InvalidFallbackBehavior -> (string)
What WAF should do if it fails to completely parse the JSON body. The options are the following:
EVALUATE_AS_STRING
- Inspect the body as plain text. WAF applies the text transformations and inspection criteria that you defined for the JSON inspection to the body text string.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.If you don't provide this setting, WAF parses and evaluates the content only up to the first parsing failure that it encounters.
Note
WAF parsing doesn't fully validate the input JSON string, so parsing can succeed even for invalid JSON. When parsing succeeds, WAF doesn't apply the fallback behavior. For more information, see JSON body in the WAF Developer Guide .OversizeHandling -> (string)
What WAF should do if the body is larger than WAF can inspect.
WAF does not support inspecting the entire contents of the web request body if the body exceeds the limit for the resource type. When a web request body is larger than the limit, the underlying host service only forwards the contents that are within the limit to WAF for inspection.
- For Application Load Balancer and AppSync, the limit is fixed at 8 KB (8,192 bytes).
- For CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access, the default limit is 16 KB (16,384 bytes), and you can increase the limit for each resource type in the web ACL
AssociationConfig
, for additional processing fees.The options for oversize handling are the following:
CONTINUE
- Inspect the available body contents normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.You can combine the
MATCH
orNO_MATCH
settings for oversize handling with your rule and web ACL action settings, so that you block any request whose body is over the limit.Default:
CONTINUE
Headers -> (structure)
Inspect the request headers. You must configure scope and pattern matching filters in the
Headers
object, to define the set of headers to and the parts of the headers that WAF inspects.Only the first 8 KB (8192 bytes) of a request's headers and only the first 200 headers are forwarded to WAF for inspection by the underlying host service. You must configure how to handle any oversize header content in the
Headers
object. WAF applies the pattern matching filters to the headers that it receives from the underlying host service.MatchPattern -> (structure)
The filter to use to identify the subset of headers to inspect in a web request.
You must specify exactly one setting: either
All
,IncludedHeaders
, orExcludedHeaders
.Example JSON:
"MatchPattern": { "ExcludedHeaders": [ "KeyToExclude1", "KeyToExclude2" ] }
All -> (structure)
Inspect all headers.IncludedHeaders -> (list)
Inspect only the headers that have a key that matches one of the strings specified here.
(string)
ExcludedHeaders -> (list)
Inspect only the headers whose keys don't match any of the strings specified here.
(string)
MatchScope -> (string)
The parts of the headers to match with the rule inspection criteria. If you specify
ALL
, WAF inspects both keys and values.All
does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logicalAND
statement to combine two match rules, one that inspects the keys and another that inspects the values.OversizeHandling -> (string)
What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.
The options for oversize handling are the following:
CONTINUE
- Inspect the available headers normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.Cookies -> (structure)
Inspect the request cookies. You must configure scope and pattern matching filters in the
Cookies
object, to define the set of cookies and the parts of the cookies that WAF inspects.Only the first 8 KB (8192 bytes) of a request's cookies and only the first 200 cookies are forwarded to WAF for inspection by the underlying host service. You must configure how to handle any oversize cookie content in the
Cookies
object. WAF applies the pattern matching filters to the cookies that it receives from the underlying host service.MatchPattern -> (structure)
The filter to use to identify the subset of cookies to inspect in a web request.
You must specify exactly one setting: either
All
,IncludedCookies
, orExcludedCookies
.Example JSON:
"MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }
All -> (structure)
Inspect all cookies.IncludedCookies -> (list)
Inspect only the cookies that have a key that matches one of the strings specified here.
(string)
ExcludedCookies -> (list)
Inspect only the cookies whose keys don't match any of the strings specified here.
(string)
MatchScope -> (string)
The parts of the cookies to inspect with the rule inspection criteria. If you specify
ALL
, WAF inspects both keys and values.All
does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logicalAND
statement to combine two match rules, one that inspects the keys and another that inspects the values.OversizeHandling -> (string)
What WAF should do if the cookies of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request cookies when they exceed 8 KB (8192 bytes) or 200 total cookies. The underlying host service forwards a maximum of 200 cookies and at most 8 KB of cookie contents to WAF.
The options for oversize handling are the following:
CONTINUE
- Inspect the available cookies normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.HeaderOrder -> (structure)
Inspect a string containing the list of the request's header names, ordered as they appear in the web request that WAF receives for inspection. WAF generates the string and then uses that as the field to match component in its inspection. WAF separates the header names in the string using colons and no added spaces, for example
host:user-agent:accept:authorization:referer
.OversizeHandling -> (string)
What WAF should do if the headers of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request headers when they exceed 8 KB (8192 bytes) or 200 total headers. The underlying host service forwards a maximum of 200 headers and at most 8 KB of header contents to WAF.
The options for oversize handling are the following:
CONTINUE
- Inspect the available headers normally, according to the rule inspection criteria.MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.JA3Fingerprint -> (structure)
Available for use with Amazon CloudFront distributions and Application Load Balancers. Match against the request's JA3 fingerprint. The JA3 fingerprint is a 32-character hash derived from the TLS Client Hello of an incoming request. This fingerprint serves as a unique identifier for the client's TLS configuration. WAF calculates and logs this fingerprint for each request that has enough TLS Client Hello information for the calculation. Almost all web requests include this information.
Note
You can use this choice only with a string matchByteMatchStatement
with thePositionalConstraint
set toEXACTLY
.You can obtain the JA3 fingerprint for client requests from the web ACL logs. If WAF is able to calculate the fingerprint, it includes it in the logs. For information about the logging fields, see Log fields in the WAF Developer Guide .
Provide the JA3 fingerprint string from the logs in your string match statement specification, to match with any future requests that have the same TLS configuration.
FallbackBehavior -> (string)
The match status to assign to the web request if the request doesn't have a JA3 fingerprint.
You can specify the following fallback behaviors:
MATCH
- Treat the web request as matching the rule statement. WAF applies the rule action to the request.NO_MATCH
- Treat the web request as not matching the rule statement.ManagedByFirewallManager -> (boolean)
Indicates whether the logging configuration was created by Firewall Manager, as part of an WAF policy configuration. If true, only Firewall Manager can modify or delete the configuration.LoggingFilter -> (structure)
Filtering that specifies which web requests are kept in the logs and which are dropped. You can filter on the rule action and on the web request labels that were applied by matching rules during web ACL evaluation.
Filters -> (list)
The filters that you want to apply to the logs.
(structure)
A single logging filter, used in LoggingFilter .
Behavior -> (string)
How to handle logs that satisfy the filter's conditions and requirement.Requirement -> (string)
Logic to apply to the filtering conditions. You can specify that, in order to satisfy the filter, a log must match all conditions or must match at least one condition.Conditions -> (list)
Match conditions for the filter.
(structure)
A single match condition for a Filter .
ActionCondition -> (structure)
A single action condition. This is the action setting that a log record must contain in order to meet the condition.
Action -> (string)
The action setting that a log record must contain in order to meet the condition. This is the action that WAF applied to the web request.
For rule groups, this is either the configured rule action setting, or if you've applied a rule action override to the rule, it's the override action. The value
EXCLUDED_AS_COUNT
matches on excluded rules and also on rules that have a rule action override of Count.LabelNameCondition -> (structure)
A single label name condition. This is the fully qualified label name that a log record must contain in order to meet the condition. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label.
LabelName -> (string)
The label name that a log record must contain in order to meet the condition. This must be a fully qualified label name. Fully qualified labels have a prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that added the label.DefaultBehavior -> (string)
Default handling for logs that don't match any of the specified filtering conditions.LogType -> (string)
Used to distinguish between various logging options. Currently, there is one option.
Default:
WAF_LOGS
LogScope -> (string)
The owner of the logging configuration, which must be set to
CUSTOMER
for the configurations that you manage.The log scope
SECURITY_LAKE
indicates a configuration that is managed through Amazon Security Lake. You can use Security Lake to collect log and event data from various sources for normalization, analysis, and management. For information, see Collecting data from Amazon Web Services services in the Amazon Security Lake user guide .Default:
CUSTOMER