Wojciech Sciesinski
Wojciech Sciesinski

Reputation: 324

Datadog monitor using Terraform - invalid query

I try to create a monitor using the Datadog Terraform provider.

The query that I try to use is

query = "logs(\"\"Write lock timeout: failed to acquire lock\" source:(productA.fluentbit.sidecar OR productA-server)\").index(\"*\").rollup(\"count\").by(\"source\").last(\"5m\") > 1"

When I run terraform plan I receive the error

│ Error: error validating monitor from https://api.XXX.datadoghq.com/api/v1/monitor/validate: 400 Bad Request: {"errors":["The value provided for parameter 'query' is invalid"]}

Upvotes: 0

Views: 1665

Answers (1)

Wojciech Sciesinski
Wojciech Sciesinski

Reputation: 324

The issu was not in the query itself but I've tried to use

type: "query alert"

but the correct one in my case is

type: "log alert"

So, yes. @marko-e, you were right. I should provide more than just the query.

Thank you everyone for help.

Upvotes: 0

Related Questions