DVA-C02 exam dumps

DVA-C02 practice question 335 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 335

Single answer

You are a developer tasked with analyzing application logs stored in Amazon CloudWatch Logs. You need to identify the average response time for a specific API endpoint where the log entries include a field called responseTime and a field called endpoint. Which of the following CloudWatch Logs Insights query snippets would achieve your goal?

  1. A

    fields responseTime | stats avg(responseTime) by endpoint | filter endpoint = '/api/v1/resource'

  2. B

    stats avg(responseTime) by endpoint | filter endpoint = '/api/v1/resource'

  3. C

    fields endpoint, responseTime | filter endpoint = '/api/v1/resource' | stats avg(responseTime)

  4. D

    filter endpoint = '/api/v1/resource' | stats avg(responseTime) | fields responseTime

Show answer and explanation

Correct answer: C

Explanation

In Amazon CloudWatch Logs Insights, the correct order of operations is crucial for accurate results. You should first extract the necessary fields, then apply any filters to reduce the dataset, and finally perform aggregation using commands like stats. Option 3 adheres to this logical flow, making it the correct answer.

  • A. Incorrect.

    This query tries to use the fields command to extract responseTime and then aggregate with stats, but it incorrectly places the filter after the aggregation which would result in incorrect filtering.

  • B. Incorrect.

    This query attempts to aggregate using stats avg(responseTime) without first extracting the responseTime field or applying the filter before the aggregation, making it invalid.

  • C. Correct.

    This is the correct query because it first selects the necessary fields (endpoint and responseTime), applies the filter to narrow down to the specific endpoint (/api/v1/resource), and then calculates the average response time using the stats command.

  • D. Incorrect.

    This query places the filter operation after the aggregation (stats), which is not valid in CloudWatch Logs Insights syntax.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam