Timeouts

Query execution times can vary widely based on the complexity of the query, amount of data being analyzed, and the load on the system and workspace at the time of the query.

Callers may want to customize the timeout for the query, which is the maximum amount of time the server will spend processing the query.

The default timeout is 3 minutes, and the maximum timeout is 10 minutes.

Timeout headers

Request

Timeouts can be set with the Prefer header in the HTTP request, using the standard wait preference, see here for details. This puts an upper bound, in seconds, on how long the client will wait for the service to process the query.

Response

If a query takes longer than the specified timeout (or default timeout, if unspecificed), it will fail with an status code of 504 Gateway Timeout.

For example, the following request allows a maximum server timeout age of 30 seconds

POST https://api.loganalytics.io/v1/workspaces/{workspace-id}/query
Authorization: Bearer <access token>
Prefer: wait=30

{
    "query" : "Heartbeat | count"
}