Bird
0
0

You want to create a log-based metric that counts error logs but excludes those from a specific VM instance named "test-instance". Which filter correctly implements this?

hard📝 Application Q9 of 15
GCP - Cloud Monitoring and Logging
You want to create a log-based metric that counts error logs but excludes those from a specific VM instance named "test-instance". Which filter correctly implements this?
Aseverity >= ERROR AND resource.labels.instance_id = "test-instance"
Bseverity >= ERROR OR resource.labels.instance_id != "test-instance"
Cseverity >= ERROR AND NOT resource.labels.instance_id = "test-instance"
Dseverity >= ERROR AND resource.labels.instance_name != "test-instance"
Step-by-Step Solution
Solution:
  1. Step 1: Use severity >= ERROR to count error logs

    This includes all logs with severity ERROR or higher.
  2. Step 2: Exclude logs from the specific VM by instance name

    The correct label for VM name is resource.labels.instance_id, not instance_name.
  3. Step 3: Combine conditions with AND and use exclusion operator

    Use AND with NOT label= or equivalent to exclude logs from "test-instance".
  4. Final Answer:

    severity >= ERROR AND NOT resource.labels.instance_id = "test-instance" -> Option C
  5. Quick Check:

    Exclude by instance_id with AND and NOT [OK]
Quick Trick: Use resource.labels.instance_id to filter VM by name [OK]
Common Mistakes:
  • Using instance_name instead of instance_id
  • Using OR instead of AND causing wrong matches
  • Using = instead of exclusion operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes