While investigating a sudden spike in failures, you open Cloud Logging > Logs Explorer. You want to display only the ERROR-level entries that were written by the Cloud Function named payment-handler, regardless of region. Which advanced filter should you enter in the query builder to see exactly those log lines and nothing else?
resource.type="cloud_function" AND resource.labels.function_name="payment-handler" AND severity=ERROR
resource.type="cloud_function" AND resource.labels.function_name="payment-handler" AND severity>=WARNING
resource.type="cloud_function" AND labels.function_name="payment-handler" AND severity="ERROR"
resource.type="cloudfunctions_function" AND resource.labels.name="payment-handler" AND severity=ERROR
resource.type must match Cloud Functions log entries, which use cloud_function.
resource.labels.function_name must match the function's name, payment-handler.
severity must equal ERROR so that only ERROR-level records are returned. Combining the three with AND produces: resource.type="cloud_function" AND resource.labels.function_name="payment-handler" AND severity=ERROR. Using severity>=WARNING also shows WARNING and higher messages. The labels.function_name path is invalid because the label resides under resource.labels, and the resource type cloudfunctions_function is not used by Cloud Functions logs, so those alternatives would not return the intended results.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Can you explain the difference between severity=ERROR and severity>=WARNING in Cloud Logging filters?
Open an interactive chat with Bash
Why is resource.type set to 'cloud_function' in the filter, and what does it represent?
Open an interactive chat with Bash
Why is labels.function_name invalid, and what is the correct path to reference the function name?
Open an interactive chat with Bash
What does resource.type signify in GCP logs?
Open an interactive chat with Bash
Why use resource.labels.function_name instead of labels.function_name?
Open an interactive chat with Bash
What is the difference between severity=ERROR and severity>=WARNING?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Ensuring successful operation of a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .