Complete the code to create a log-based metric that counts error logs.
gcloud logging metrics create error_count --description="Count of error logs" --log-filter="severity=[1]"
The severity level ERROR filters logs to count only error messages.
Complete the code to create a metric that counts logs with the text 'timeout'.
gcloud logging metrics create timeout_count --description="Count of timeout logs" --log-filter="textPayload:[1]"
The filter textPayload:"timeout" matches logs containing the word 'timeout'.
Fix the error in the log filter to count logs with severity WARNING or higher.
gcloud logging metrics create warning_and_above --description="Count of warnings and above" --log-filter="severity [1] WARNING"
The operator >= selects logs with severity WARNING or higher.
Fill both blanks to create a metric that counts logs from a specific resource type and severity ERROR.
gcloud logging metrics create resource_error_count --description="Count of error logs from resource" --log-filter="resource.type=[1] AND severity=[2]"
The filter selects logs from Google Compute Engine instances with severity ERROR.
Fill all three blanks to create a metric that counts logs with severity ERROR, from a specific project, and containing the word 'failure'.
gcloud logging metrics create project_failure_errors --description="Count of failure errors in project" --log-filter="resource.labels.project_id=[1] AND severity=[2] AND textPayload:[3]"
This filter counts error logs containing 'failure' from the specified project.