CorefinityCorefinityDocs
Open the Control PanelControl Panel
Logs · 21 of 25

Search a site's logs

Answers the lines of the site that match, newest first; a query that ends in an aggregating pipe, such as | stats count(), answers kind table with table instead of lines. Paged by cursor: send next_cursor back as cursor; null means the last page.

POST/api/corestack/sites/{site}/logs/query

Path parameters

siteintegerRequired

The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.

Body

environment_idinteger or null

The site row id of another environment of the same website to read instead of {site}. At least 1.

filtersobject or any or null

Filters applied beside the query.

fromstring or null

The start of the time range, as a date and time. It must be inside the time your logs are kept for.

querystring or null

A LogsQL query, sent as written. Every line when left out. Up to 4 KB. Up to 4,096 characters.

rangestring or any or null

How far back from now to read. One hour when neither range nor from is sent. Ignored when from is sent.

scopestring or null

env reads the one environment. site reads every environment of the website that you can see. Defaults to env.

envsitenull
sourcestring

A log source. all reads every source. search and queue exist only on platforms that run them; the sources list says which ones an environment has. Defaults to all.

allweb-accessweb-errorphpappcrondatabasecachesearchqueue
tostring or null

The end of the time range, as a date and time. Now when left out.

cursorstring or null

The next_cursor of the previous page, sent with the same request. A cursor from another request or another access token is refused 422 on cursor.

facetsarray of strings or string or any or null

Field names whose ten most frequent values to answer beside the lines, as a list or one comma-separated value.

limitinteger or null

Lines a page. Defaults to 200. 1 to 1000.

Returns

200 A page of lines, or a table.

Fields of the 200 answer
next_cursorstring or nullRequired

Send as cursor to read the next page. Null on the last page.

effective_querystringRequired

The query that was run. * when none was sent.

facetsobject or array

The fields asked for with facets. Sent only when the request names some and kind is records.

kindstringRequired

records for log lines, table for the answer of an aggregating query.

recordstable
linesarray of objectsRequired

The lines, newest first. Empty when kind is table.

Fields of each item
fieldsobject or arrayRequired

The line's other fields, by name. An empty list when it has none.

msgstringRequired

The line's text.

sourcestringRequired

A log source. all reads every source. search and queue exist only on platforms that run them; the sources list says which ones an environment has. Defaults to all.

allweb-accessweb-errorphpappcrondatabasecachesearchqueue
stream_idstringRequired

The stream the line belongs to. With time, it names the line for the context endpoint.

timestringRequired

When the line was written. Format: date-time.

statsobjectRequired
Fields
duration_msintegerRequired

How long the read took.

tablearray of objects or any or nullRequired

The groups of an aggregating query. Null when kind is records.

tenantobjectRequired

The logs quota the lines count against.

Fields
percentintegerRequired

How much of the quota is used.

quota_gbintegerRequired
retention_daysintegerRequired

How many days lines are kept for.

statestringRequired

ok, warning when the quota is nearly used, over_quota, or unavailable.

okwarningover_quotaunavailable
stored_gbnumberRequired
truncatedbooleanRequired

True when a table was cut at limit rows a group.

warningsarray of stringsRequired
windowobjectRequired

The exact time range that was read. Send from and to back to read the same range again.

Fields
fromstringRequired

Format: date-time.

tostringRequired

Format: date-time.

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403two_factor_requiredTurn on two-factor on your account, then send again.
404feature_offThis feature is not on for your organisation yet.
409logs_not_collectedLogs are not being collected for the environment yet. Try again later, or contact support.
409logs_rangeThe time range is outside the days logs are kept for. Choose a range inside the days the message names.
409logs_unavailableLogs could not be read, or are not collected for the site yet. Read the message; try again shortly.
409query_too_wideThe search covers too much. Choose a shorter range or a narrower search.
422invalidFix the field named in field; errors says why.
429rate_limitedWait for the seconds in Retry-After.
503logs_busyLogs are busy at the moment. Try again in a few seconds.
503logs_cluster_unavailableLogs are not available at the moment. Try again shortly.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/logs/query \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "limit": 200,
    "query": "status:>=500",
    "range": "1h",
    "source": "web-access"
  }'
{
  "effective_query": "status:>=500",
  "kind": "records",
  "lines": [
    {
      "fields": {
        "level": "error",
        "method": "GET",
        "src": "nginx-access",
        "status": 502
      },
      "msg": "GET /checkout 502",
      "source": "web-access",
      "stream_id": "00000001000000006754af9632a2745e85c293e5aac08633",
      "time": "2026-11-03T09:55:41.215Z"
    },
    {
      "fields": {
        "level": "error",
        "method": "POST",
        "src": "nginx-access",
        "status": 500
      },
      "msg": "POST /basket/add 500",
      "source": "web-access",
      "stream_id": "00000001000000006754af9632a2745e85c293e5aac08633",
      "time": "2026-11-03T09:52:07.004Z"
    }
  ],
  "next_cursor": null,
  "stats": {
    "duration_ms": 84
  },
  "table": null,
  "tenant": {
    "percent": 42,
    "quota_gb": 20,
    "retention_days": 90,
    "state": "ok",
    "stored_gb": 8.4
  },
  "truncated": false,
  "warnings": [],
  "window": {
    "from": "2026-11-03T09:00:00.000000000Z",
    "to": "2026-11-03T10:00:00.000000000Z"
  }
}
Try it
Held in this tab's memory only. Never stored or sent to us.

This sends a real POST request and changes your account.

Use a token with only the read scope. How to make one

Was this helpful?
Open in ClaudeOpen in ChatGPT