Bird
0
0

You have a log group with thousands of log streams. You want to find the most recent log stream with logs. Which AWS CLI command helps you achieve this efficiently?

hard📝 Application Q9 of 15
AWS - CloudWatch
You have a log group with thousands of log streams. You want to find the most recent log stream with logs. Which AWS CLI command helps you achieve this efficiently?
Aaws logs describe-log-streams --log-group-name MyGroup --order-by LastEventTime --descending --limit 1
Baws logs get-log-events --log-group-name MyGroup --limit 1
Caws logs filter-log-events --log-group-name MyGroup --limit 1
Daws logs list-log-groups --limit 1
Step-by-Step Solution
Solution:
  1. Step 1: Identify command to list log streams sorted by last event time

    Describe-log-streams supports ordering by LastEventTime and limiting results.
  2. Step 2: Confirm command filters to most recent stream

    Using --order-by LastEventTime, --descending, and --limit 1 returns the newest log stream.
  3. Final Answer:

    aws logs describe-log-streams --log-group-name MyGroup --order-by LastEventTime --descending --limit 1 -> Option A
  4. Quick Check:

    Describe-log-streams with order and limit finds recent stream [OK]
Quick Trick: Use describe-log-streams with order-by and limit [OK]
Common Mistakes:
  • Using get-log-events without specifying stream
  • Using filter-log-events which searches logs, not streams
  • Listing log groups instead of streams

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes