Note
This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.
For the latest version of AWS WAF , use the AWS WAFV2 API and see the AWS WAF Developer Guide . With the latest version, AWS WAF has a single set of endpoints for regional and global use.
Gets detailed information about a specified number of requests–a sample–that AWS WAF randomly selects from among the first 5,000 requests that your AWS resource received during a time range that you choose. You can specify a sample size of up to 500 requests, and you can specify any time range in the previous three hours.
GetSampledRequestsreturns a time range, which is usually the time range that you specified. However, if your resource (such as a CloudFront distribution) received 5,000 requests before the specified time range elapsed,GetSampledRequestsreturns an updated time range. This new time range indicates the actual period during which AWS WAF selected the requests in the sample.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
get-sampled-requests
--web-acl-id <value>
--rule-id <value>
--time-window <value>
--max-items <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--web-acl-id (string)
The
WebACLIdof theWebACLfor which you wantGetSampledRequeststo return a sample of requests.
--rule-id (string)
RuleIdis one of three values:
The
RuleIdof theRuleor theRuleGroupIdof theRuleGroupfor which you wantGetSampledRequeststo return a sample of requests.
Default_Action, which causesGetSampledRequeststo return a sample of the requests that didn’t match any of the rules in the specifiedWebACL.
--time-window (structure)
The start date and time and the end date and time of the range for which you want
GetSampledRequeststo return a sample of requests. You must specify the times in Coordinated Universal Time (UTC) format. UTC format includes the special designator,Z. For example,"2016-09-27T14:50Z". You can specify any time range in the previous three hours.StartTime -> (timestamp)
The beginning of the time range from which you want
GetSampledRequeststo return a sample of the requests that your AWS resource received. You must specify the date and time in Coordinated Universal Time (UTC) format. UTC format includes the special designator,Z. For example,"2016-09-27T14:50Z". You can specify any time range in the previous three hours.EndTime -> (timestamp)
The end of the time range from which you want
GetSampledRequeststo return a sample of the requests that your AWS resource received. You must specify the date and time in Coordinated Universal Time (UTC) format. UTC format includes the special designator,Z. For example,"2016-09-27T14:50Z". You can specify any time range in the previous three hours.
Shorthand Syntax:
StartTime=timestamp,EndTime=timestamp
JSON Syntax:
{
"StartTime": timestamp,
"EndTime": timestamp
}
--max-items (long)
The number of requests that you want AWS WAF to return from among the first 5,000 requests that your AWS resource received during the time range. If your resource received fewer requests than the value of
MaxItems,GetSampledRequestsreturns information about all of them.
--cli-input-json | --cli-input-yaml (string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those 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. This may not be specified along with --cli-input-yaml.
--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. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
SampledRequests -> (list)
A complex type that contains detailed information about each of the requests in the sample.
(structure)
Note
This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.
For the latest version of AWS WAF , use the AWS WAFV2 API and see the AWS WAF Developer Guide . With the latest version, AWS WAF has a single set of endpoints for regional and global use.
The response from a GetSampledRequests request includes a
SampledHTTPRequestscomplex type that appears asSampledRequestsin the response syntax.SampledHTTPRequestscontains oneSampledHTTPRequestobject for each web request that is returned byGetSampledRequests.Request -> (structure)
A complex type that contains detailed information about the request.
ClientIP -> (string)
The IP address that the request originated from. If the
WebACLis associated with a CloudFront distribution, this is the value of one of the following fields in CloudFront access logs:
c-ip, if the viewer did not use an HTTP proxy or a load balancer to send the request
x-forwarded-for, if the viewer did use an HTTP proxy or a load balancer to send the requestCountry -> (string)
The two-letter country code for the country that the request originated from. For a current list of country codes, see the Wikipedia entry ISO 3166-1 alpha-2 .
URI -> (string)
The part of a web request that identifies the resource, for example,
/images/daily-ad.jpg.Method -> (string)
The HTTP method specified in the sampled web request. CloudFront supports the following methods:
DELETE,GET,HEAD,OPTIONS,PATCH,POST, andPUT.HTTPVersion -> (string)
The HTTP version specified in the sampled web request, for example,
HTTP/1.1.Headers -> (list)
A complex type that contains two values for each header in the sampled web request: the name of the header and the value of the header.
(structure)
Note
This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.
For the latest version of AWS WAF , use the AWS WAFV2 API and see the AWS WAF Developer Guide . With the latest version, AWS WAF has a single set of endpoints for regional and global use.
The response from a GetSampledRequests request includes an
HTTPHeadercomplex type that appears asHeadersin the response syntax.HTTPHeadercontains the names and values of all of the headers that appear in one of the web requests that were returned byGetSampledRequests.Name -> (string)
The name of one of the headers in the sampled web request.
Value -> (string)
The value of one of the headers in the sampled web request.
Weight -> (long)
A value that indicates how one result in the response relates proportionally to other results in the response. A result that has a weight of
2represents roughly twice as many CloudFront web requests as a result that has a weight of1.Timestamp -> (timestamp)
The time at which AWS WAF received the request from your AWS resource, in Unix time format (in seconds).
Action -> (string)
The action for the
Rulethat the request matched:ALLOW,BLOCK, orCOUNT.RuleWithinRuleGroup -> (string)
This value is returned if the
GetSampledRequestsrequest specifies the ID of aRuleGrouprather than the ID of an individual rule.RuleWithinRuleGroupis the rule within the specifiedRuleGroupthat matched the request listed in the response.
PopulationSize -> (long)
The total number of requests from which
GetSampledRequestsgot a sample ofMaxItemsrequests. IfPopulationSizeis less thanMaxItems, the sample includes every request that your AWS resource received during the specified time range.
TimeWindow -> (structure)
Usually,
TimeWindowis the time range that you specified in theGetSampledRequestsrequest. However, if your AWS resource received more than 5,000 requests during the time range that you specified in the request,GetSampledRequestsreturns the time range for the first 5,000 requests. Times are in Coordinated Universal Time (UTC) format.StartTime -> (timestamp)
The beginning of the time range from which you want
GetSampledRequeststo return a sample of the requests that your AWS resource received. You must specify the date and time in Coordinated Universal Time (UTC) format. UTC format includes the special designator,Z. For example,"2016-09-27T14:50Z". You can specify any time range in the previous three hours.EndTime -> (timestamp)
The end of the time range from which you want
GetSampledRequeststo return a sample of the requests that your AWS resource received. You must specify the date and time in Coordinated Universal Time (UTC) format. UTC format includes the special designator,Z. For example,"2016-09-27T14:50Z". You can specify any time range in the previous three hours.