CorefinityCorefinityDocs
Open the Control PanelControl Panel
Logs · 17 of 25

Get the facets of a site's logs

Answers the ten most frequent values of each field the matching lines carry. Takes the same source, query, filters and time as a search.

GET/api/corestack/sites/{site}/logs/facets

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.

Query parameters

environment_idinteger

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

scopestring

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

envsite
sourcestring

The log source to read. Defaults to all.

allweb-accessweb-errorphpappcrondatabasecachesearchqueue
querystring

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

filtersstring

The filters of a search (see the search's filters), as JSON encoded in base64.

rangestring

How far back from now to read. Ignored when from is sent.

15m1h6h24h7d30d
fromstring

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

tostring

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

Returns

200 The facets.

Fields of the 200 answer
facetsobject or arrayRequired

The most frequent values of each field, by field name. An empty list when no line matched.

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 https://manage.corefinity.com/api/corestack/sites/1042/logs/facets \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json"
{
  "facets": {
    "level": [
      {
        "count": 41203,
        "value": "info"
      },
      {
        "count": 17,
        "value": "error"
      }
    ],
    "method": [
      {
        "count": 39870,
        "value": "GET"
      },
      {
        "count": 1350,
        "value": "POST"
      }
    ],
    "status": [
      {
        "count": 41203,
        "value": "200"
      },
      {
        "count": 812,
        "value": "404"
      },
      {
        "count": 17,
        "value": "500"
      }
    ]
  }
}
Try it
Held in this tab's memory only. Never stored or sent to us.

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

Was this helpful?
Open in ClaudeOpen in ChatGPT