CLOUD-DEPLOYMENT-AND-OPERATIONS practice question 3 of 15
(Which CloudWatch metric filter includes log events with the word ERROR but excludes log events with the word WARNING?)
Full set: 67 questionsThe Amazon CloudWatch Logs filter and pattern syntax uses a space to represent an implicit AND operator, meaning all specified terms must be present. To exclude a term, you prefix it with a hyphen (-). Therefore, the filter ERROR -WARN correctly translates to "find log events that contain the word 'ERROR' AND do NOT contain the word 'WARN'". This precisely matches the requirements of the question.
A. ?ERROR ?WARN: The question mark (?) specifies that the preceding term is optional. This filter does not enforce the presence of "ERROR" or the absence of "WARN".
B. "ERROR" WARN: This filter requires log events to contain both the exact term "ERROR" and the term "WARN", which is the opposite of the desired exclusion.
D. ERROR WARN: Similar to option B, this filter requires log events to contain both the term "ERROR" and the term "WARN" due to the implicit AND operator.
1. AWS CloudWatch Documentation, "Filter and pattern syntax":
Section on Exclusion: "You can specify a term to exclude from the results by prefixing it with a minus sign (-). For example, the term error -warning returns strings that contain error but that don't contain warning." This directly supports the correct answer C.
Section on Default Operator: "By default, terms in a filter pattern are separated by spaces. All terms must appear in a log event for it to match the filter." This explains why options B and D are incorrect.
Section on Optional Terms: "You can use a question mark to specify that the preceding term is optional. For example, ?error means that the term error is optional." This explains why option A is incorrect.
Source: Amazon Web Services, Inc. (2023). Amazon CloudWatch Logs User Guide. Retrieved from https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
Keep practicing
Take the free CLOUD-DEPLOYMENT-AND-OPERATIONS practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CLOUD-DEPLOYMENT-AND-OPERATIONS practice questions
- Question 1(What is the role of AWS Trusted Advisor?)
- Question 2(Which action must be used to create a metric filter in the Amazon CloudWatch console?)
- Question 4(Media files are stored in an S3 bucket in region A. Demand for the files from region B h…
- Question 5(A company is using Route 53 for Domain Name System (DNS) hosting. The company requires a…
- Question 6(A company configures the CloudFront caching TTL to the following settings: Min: 0, Max: …
- Question 7(Which AWS service is used to provide remote workers with secure access to AWS resources?)
