Wannabe
Wannabe

Reputation: 111

GCP user-created log-based alert policies error: Can not find metric resource_container_ids

This error seems to be the same as this issue, supposedly fixed in 2021. Is this a recurring bug? The page shown in the picture is what I'm redirected to after clicking "Create alert from metric" from the 'more actions' button under Logging -> Log-based metrics.

Looking at the network tab, the following 404 is returned:

{
  "error": {
    "code": 404,
    "message": "Can not find metric resource_container_ids: \t <redacted> request_context: REQUEST_CONTEXT_READ filter: \"type = \\\"logging.googleapis.com/user/test3\\\"\" query_context { user_name: \"<redacted>@<redacted>.org\" resource_container_ids: <redacted> } allow_dynamic_cross_project_querying: true. If the metric was created recently, it could take up to 10 minutes to become available. Please try again soon.",
    "status": "NOT_FOUND"
  }
}

It has already been a few hours since I created the alert policy.

enter image description here

Upvotes: 1

Views: 1019

Answers (1)

Wannabe
Wannabe

Reputation: 111

After further investigation, this issue only appears when I include the resource.labels.project_id label in my log filter. It doesn't show up on autocomplete under the "Filter Selection" section when creating log-based metric, but works fine in Logs Explorer... strangely. It seems like it isn't recognised as a valid filter?

Before:

resource.labels.project_id="my-project"
logName="projects/myproject/logs/terrain-log"
severity=ERROR

enter image description here

After:

logName="projects/myproject/logs/terrain-log"
severity=ERROR

enter image description here

Upvotes: 0

Related Questions