Skip to content
v1
Docs

API reference

Logs

Search, count and facet the organisation’s collected log lines over a time window.

Its operations need the scope logs.view.

Read one log line

GET/v1/logs/{line_uuid}

Returns one log line named by its uuid and the at time of the console link that shows it (/logs/<uuid>?at=<time>), with its full text, its exact time to the nanosecond, where that time comes from (time_source) and, for a Log Source line, the text the sender submitted (raw_line). at is the link’s at as it is, or the line’s logged_at in epoch milliseconds. A line that is gone, or that is not one of the organisation’s server or log source lines, is a 422.

Needs the scope logs.view.

Path parameters

  • line_uuidstringRequired

    The line’s uuid, as a search answers it and the console’s link carries it.

Query parameters

  • atstringRequired

    The line’s time (RFC 3339 with an offset, up to nine fraction digits: the console link’s at is passed as it is) or its logged_at (epoch milliseconds). It bounds the lookup of the line, so it is required.

Returns

200 OK:

The log line.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Read the lines around a log line

GET/v1/logs/context

Returns the lines logged just before and just after one line of the same source and stream, newest first, with the line itself marked is_anchor. Name the line by its uuid and logged_at from a search. before and after count lines, 20 each by default and 100 at most; has_older_more and has_newer_more say whether more lines exist beyond them. A line that is gone, or that is not one of the organisation’s server or log source lines, is a 422.

Needs the scope logs.view.

Query parameters

  • uuidstringRequired

    The line’s uuid, as the search answers it.

  • atstringRequired

    When the line was logged (its logged_at, epoch milliseconds, or RFC 3339 with an offset): it bounds the lookup of the line.

  • beforeinteger or nullOptional

    The number of older lines to return, from 0 to 100; 20 when omitted.

  • afterinteger or nullOptional

    The number of newer lines to return, from 0 to 100; 20 when omitted.

Returns

200 OK:

The lines around the line asked, newest first.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Count logs by level and stream

GET/v1/logs/facets

Counts the lines the search filters match by level and by stream, most first. The window defaults to the last hour and reaches back to retention (30 days); a window that ends in the future ends now, and window says the window read. Lines with no level are not counted in the levels but in unlevelled_count (select them with levels[]=unknown), and the stream list ignores the stream filter so every candidate stream stays listed.

Needs the scope logs.view.

Query parameters

  • source_uuidsarray of strings or nullOptional

    Only lines from these servers or log sources, by uuid (a server’s uuid gives that server’s lines); a deleted one’s lines stay searchable for the retention. A list: repeat the parameter (source_uuids=<uuid>&source_uuids=<uuid>) or send one value (source_uuids=<uuid>); source_uuids[]=<uuid> is accepted too.

  • levelsarray of strings or nullOptional

    Only lines at one of these levels: debug, info, notice, warning, error, critical, alert or emergency; unknown selects the lines with no level (their level is null). A list: repeat the parameter (levels=debug&levels=info) or send one value (levels=debug); levels[]=debug is accepted too.

    Values:debuginfonoticewarningerrorcriticalalertemergencyunknown(an open set: new values may be added)
  • streamsarray of strings or nullOptional

    Only lines in one of these streams. A list: repeat the parameter (streams=<value>&streams=<value>) or send one value (streams=<value>); streams[]=<value> is accepted too.

  • searchstring or nullOptional

    Only lines whose text contains this text.

  • tag_uuidsarray of strings or nullOptional

    Only lines from servers and log sources carrying any of these tags, by uuid. A list: repeat the parameter (tag_uuids=<uuid>&tag_uuids=<uuid>) or send one value (tag_uuids=<uuid>); tag_uuids[]=<uuid> is accepted too.

  • periodstring or nullOptional

    A relative window ending now: 1 to 9999 minutes, hours, days or weeks (3h, 2w). Not with from and to. The operation names its longest window and its default.

  • fromstring or nullOptional

    The start of a pinned window, epoch milliseconds or RFC 3339 with an offset. Needs to. A start before the oldest data kept is served from it.

  • tostring or nullOptional

    The end of a pinned window, epoch milliseconds or RFC 3339 with an offset, after from. A window that ends before the oldest data kept is refused; one that ends in the future ends now, and the answer’s window says so.

  • excludearray of strings or nullOptional

    Only lines that contain none of these texts: at most 5, each at most 200 characters. search_case applies to them; search_mode does not, they are always literal text. A list: repeat the parameter (exclude=<value>&exclude=<value>) or send one value (exclude=<value>); exclude[]=<value> is accepted too.

  • search_modestring or nullOptional

    How search is read: substring (the default) or regex, an RE2 pattern of at most 500 characters with no lookahead, lookbehind, backreference, possessive quantifier or atomic group.

    Values:substringregex(an open set: new values may be added)
  • search_casestring or nullOptional

    Whether search and exclude ignore case: sensitive (the default) or insensitive. It sets the case of every include and exclude list too.

    Values:sensitiveinsensitive(an open set: new values may be added)
  • unitsarray of strings or nullOptional

    Only lines from these systemd units, exactly (cloudflared.service): at most 20. Null on lines that did not come from a journal, and on lines from an agent too old to report the unit. A list: repeat the parameter (units=<value>&units=<value>) or send one value (units=<value>); units[]=<value> is accepted too.

  • identifiersarray of strings or nullOptional

    Only lines with these journal identifiers (SYSLOG_IDENTIFIER, such as sshd), exactly: at most 20. A list: repeat the parameter (identifiers=<value>&identifiers=<value>) or send one value (identifiers=<value>); identifiers[]=<value> is accepted too.

  • http_statusesarray of strings or nullOptional

    Only lines whose parsed HTTP status is one of these: a code (502) or a class (5xx), at most 10. Only access log lines the backend parsed (a file entry with a format) have a status. A list: repeat the parameter (http_statuses=<value>&http_statuses=<value>) or send one value (http_statuses=<value>); http_statuses[]=<value> is accepted too.

  • includearray of strings or nullOptional

    Only lines that contain each of these texts (or any of them, with match=any): literal text of 1 to 500 characters. A search holds at most 10 terms: search, exclude and every include and exclude list count together. A list: repeat the parameter (include=<value>&include=<value>) or send one value (include=<value>); include[]=<value> is accepted too.

  • include_wordsarray of strings or nullOptional

    Only lines that contain each of these whole words: a word is bounded where its first and last characters are letters, digits or underscores (ASCII only, so café is bounded at caf). A list: repeat the parameter (include_words=<value>&include_words=<value>) or send one value (include_words=<value>); include_words[]=<value> is accepted too.

  • include_regexarray of strings or nullOptional

    Only lines that match each of these RE2 regular expressions: no lookahead, lookbehind, backreference, possessive quantifier or atomic group. At most 5 regex terms, with exclude_regex and a search with search_mode=regex. Start one with (?i) to ignore case in that term alone. A list: repeat the parameter (include_regex=<value>&include_regex=<value>) or send one value (include_regex=<value>); include_regex[]=<value> is accepted too.

  • exclude_wordsarray of strings or nullOptional

    Only lines that contain none of these whole words. A list: repeat the parameter (exclude_words=<value>&exclude_words=<value>) or send one value (exclude_words=<value>); exclude_words[]=<value> is accepted too.

  • exclude_regexarray of strings or nullOptional

    Only lines that match none of these RE2 regular expressions, as include_regex takes them. A list: repeat the parameter (exclude_regex=<value>&exclude_regex=<value>) or send one value (exclude_regex=<value>); exclude_regex[]=<value> is accepted too.

  • matchstring or nullOptional

    How the included terms combine: all (the default), a line matches every one, or any, at least one; the excluded terms always apply. Needs an included term (search, include, include_words or include_regex). search_case sets the case of every term.

    Values:allany(an open set: new values may be added)

Returns

200 OK:

The level and stream counts of the matching lines.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Count logs by a field

GET/v1/logs/groups

Counts the lines the search filters match by one field (stream, level, source, unit, identifier, HTTP status, HTTP path or message pattern), most first, by=pattern counts the messages with their numbers, UUIDs, addresses and times replaced by placeholders (<N>, <UUID>, <IP4>, <TIME>), so repeated errors count as one pattern instead of being downloaded; at most 100 groups. The window defaults to the last hour and reaches back to retention (30 days); a window that ends in the future ends now, and window says the window read. A line without the field is counted under a null value.

Needs the scope logs.view.

Query parameters

  • bystringRequired

    What to count the lines by: stream, level, source, unit, identifier, http_status, http_path or pattern (the message with its numbers, hexadecimal values, UUIDs, addresses and times replaced by placeholders such as <N>, <UUID>, <IP4> and <TIME>, most frequent first; each value cut at 1,000 characters).

    Values:streamlevelsourceunitidentifierhttp_statushttp_pathpattern(an open set: new values may be added)
  • source_uuidsarray of strings or nullOptional

    Only lines from these servers or log sources, by uuid (a server’s uuid gives that server’s lines); a deleted one’s lines stay searchable for the retention. A list: repeat the parameter (source_uuids=<uuid>&source_uuids=<uuid>) or send one value (source_uuids=<uuid>); source_uuids[]=<uuid> is accepted too.

  • levelsarray of strings or nullOptional

    Only lines at one of these levels: debug, info, notice, warning, error, critical, alert or emergency; unknown selects the lines with no level (their level is null). A list: repeat the parameter (levels=debug&levels=info) or send one value (levels=debug); levels[]=debug is accepted too.

    Values:debuginfonoticewarningerrorcriticalalertemergencyunknown(an open set: new values may be added)
  • streamsarray of strings or nullOptional

    Only lines in one of these streams. A list: repeat the parameter (streams=<value>&streams=<value>) or send one value (streams=<value>); streams[]=<value> is accepted too.

  • searchstring or nullOptional

    Only lines whose text contains this text.

  • tag_uuidsarray of strings or nullOptional

    Only lines from servers and log sources carrying any of these tags, by uuid. A list: repeat the parameter (tag_uuids=<uuid>&tag_uuids=<uuid>) or send one value (tag_uuids=<uuid>); tag_uuids[]=<uuid> is accepted too.

  • periodstring or nullOptional

    A relative window ending now: 1 to 9999 minutes, hours, days or weeks (3h, 2w). Not with from and to. The operation names its longest window and its default.

  • fromstring or nullOptional

    The start of a pinned window, epoch milliseconds or RFC 3339 with an offset. Needs to. A start before the oldest data kept is served from it.

  • tostring or nullOptional

    The end of a pinned window, epoch milliseconds or RFC 3339 with an offset, after from. A window that ends before the oldest data kept, or in the future, is refused.

  • limitinteger or nullOptional

    The number of groups, from 1 to 100; 50 when omitted.

  • excludearray of strings or nullOptional

    Only lines that contain none of these texts: at most 5, each at most 200 characters. search_case applies to them; search_mode does not, they are always literal text. A list: repeat the parameter (exclude=<value>&exclude=<value>) or send one value (exclude=<value>); exclude[]=<value> is accepted too.

  • search_modestring or nullOptional

    How search is read: substring (the default) or regex, an RE2 pattern of at most 500 characters with no lookahead, lookbehind, backreference, possessive quantifier or atomic group.

    Values:substringregex(an open set: new values may be added)
  • search_casestring or nullOptional

    Whether search and exclude ignore case: sensitive (the default) or insensitive. It sets the case of every include and exclude list too.

    Values:sensitiveinsensitive(an open set: new values may be added)
  • unitsarray of strings or nullOptional

    Only lines from these systemd units, exactly (cloudflared.service): at most 20. Null on lines that did not come from a journal, and on lines from an agent too old to report the unit. A list: repeat the parameter (units=<value>&units=<value>) or send one value (units=<value>); units[]=<value> is accepted too.

  • identifiersarray of strings or nullOptional

    Only lines with these journal identifiers (SYSLOG_IDENTIFIER, such as sshd), exactly: at most 20. A list: repeat the parameter (identifiers=<value>&identifiers=<value>) or send one value (identifiers=<value>); identifiers[]=<value> is accepted too.

  • http_statusesarray of strings or nullOptional

    Only lines whose parsed HTTP status is one of these: a code (502) or a class (5xx), at most 10. Only access log lines the backend parsed (a file entry with a format) have a status. A list: repeat the parameter (http_statuses=<value>&http_statuses=<value>) or send one value (http_statuses=<value>); http_statuses[]=<value> is accepted too.

  • includearray of strings or nullOptional

    Only lines that contain each of these texts (or any of them, with match=any): literal text of 1 to 500 characters. A search holds at most 10 terms: search, exclude and every include and exclude list count together. A list: repeat the parameter (include=<value>&include=<value>) or send one value (include=<value>); include[]=<value> is accepted too.

  • include_wordsarray of strings or nullOptional

    Only lines that contain each of these whole words: a word is bounded where its first and last characters are letters, digits or underscores (ASCII only, so café is bounded at caf). A list: repeat the parameter (include_words=<value>&include_words=<value>) or send one value (include_words=<value>); include_words[]=<value> is accepted too.

  • include_regexarray of strings or nullOptional

    Only lines that match each of these RE2 regular expressions: no lookahead, lookbehind, backreference, possessive quantifier or atomic group. At most 5 regex terms, with exclude_regex and a search with search_mode=regex. Start one with (?i) to ignore case in that term alone. A list: repeat the parameter (include_regex=<value>&include_regex=<value>) or send one value (include_regex=<value>); include_regex[]=<value> is accepted too.

  • exclude_wordsarray of strings or nullOptional

    Only lines that contain none of these whole words. A list: repeat the parameter (exclude_words=<value>&exclude_words=<value>) or send one value (exclude_words=<value>); exclude_words[]=<value> is accepted too.

  • exclude_regexarray of strings or nullOptional

    Only lines that match none of these RE2 regular expressions, as include_regex takes them. A list: repeat the parameter (exclude_regex=<value>&exclude_regex=<value>) or send one value (exclude_regex=<value>); exclude_regex[]=<value> is accepted too.

  • matchstring or nullOptional

    How the included terms combine: all (the default), a line matches every one, or any, at least one; the excluded terms always apply. Needs an included term (search, include, include_words or include_regex). search_case sets the case of every term.

    Values:allany(an open set: new values may be added)

Returns

200 OK:

The line counts by the field asked, and the window read.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.

Count logs over time

GET/v1/logs/histogram

Counts the lines the search filters match per time bucket, split by level. The window defaults to the last day and reaches back to retention (30 days); a window that ends in the future ends now, and window says the window read. With no step the window is split into 48 buckets; a step that gives more than 1,440 buckets is refused. Only buckets that hold a line are returned.

Needs the scope logs.view.

Query parameters

  • source_uuidsarray of strings or nullOptional

    Only lines from these servers or log sources, by uuid (a server’s uuid gives that server’s lines); a deleted one’s lines stay searchable for the retention. A list: repeat the parameter (source_uuids=<uuid>&source_uuids=<uuid>) or send one value (source_uuids=<uuid>); source_uuids[]=<uuid> is accepted too.

  • levelsarray of strings or nullOptional

    Only lines at one of these levels: debug, info, notice, warning, error, critical, alert or emergency; unknown selects the lines with no level (their level is null). A list: repeat the parameter (levels=debug&levels=info) or send one value (levels=debug); levels[]=debug is accepted too.

    Values:debuginfonoticewarningerrorcriticalalertemergencyunknown(an open set: new values may be added)
  • streamsarray of strings or nullOptional

    Only lines in one of these streams. A list: repeat the parameter (streams=<value>&streams=<value>) or send one value (streams=<value>); streams[]=<value> is accepted too.

  • searchstring or nullOptional

    Only lines whose text contains this text.

  • tag_uuidsarray of strings or nullOptional

    Only lines from servers and log sources carrying any of these tags, by uuid. A list: repeat the parameter (tag_uuids=<uuid>&tag_uuids=<uuid>) or send one value (tag_uuids=<uuid>); tag_uuids[]=<uuid> is accepted too.

  • periodstring or nullOptional

    A relative window ending now: 1 to 9999 minutes, hours, days or weeks (3h, 2w). Not with from and to. The operation names its longest window and its default.

  • fromstring or nullOptional

    The start of a pinned window, epoch milliseconds or RFC 3339 with an offset. Needs to. A start before the oldest data kept is served from it.

  • tostring or nullOptional

    The end of a pinned window, epoch milliseconds or RFC 3339 with an offset, after from. A window that ends before the oldest data kept is refused; one that ends in the future ends now, and the answer’s window says so.

  • stepstring or nullOptional

    The width of a bucket as a whole number and a unit, s, m, h or d, such as 5m; at most 1,440 buckets for the window, and the window divided by 48 when omitted.

  • excludearray of strings or nullOptional

    Only lines that contain none of these texts: at most 5, each at most 200 characters. search_case applies to them; search_mode does not, they are always literal text. A list: repeat the parameter (exclude=<value>&exclude=<value>) or send one value (exclude=<value>); exclude[]=<value> is accepted too.

  • search_modestring or nullOptional

    How search is read: substring (the default) or regex, an RE2 pattern of at most 500 characters with no lookahead, lookbehind, backreference, possessive quantifier or atomic group.

    Values:substringregex(an open set: new values may be added)
  • search_casestring or nullOptional

    Whether search and exclude ignore case: sensitive (the default) or insensitive. It sets the case of every include and exclude list too.

    Values:sensitiveinsensitive(an open set: new values may be added)
  • unitsarray of strings or nullOptional

    Only lines from these systemd units, exactly (cloudflared.service): at most 20. Null on lines that did not come from a journal, and on lines from an agent too old to report the unit. A list: repeat the parameter (units=<value>&units=<value>) or send one value (units=<value>); units[]=<value> is accepted too.

  • identifiersarray of strings or nullOptional

    Only lines with these journal identifiers (SYSLOG_IDENTIFIER, such as sshd), exactly: at most 20. A list: repeat the parameter (identifiers=<value>&identifiers=<value>) or send one value (identifiers=<value>); identifiers[]=<value> is accepted too.

  • http_statusesarray of strings or nullOptional

    Only lines whose parsed HTTP status is one of these: a code (502) or a class (5xx), at most 10. Only access log lines the backend parsed (a file entry with a format) have a status. A list: repeat the parameter (http_statuses=<value>&http_statuses=<value>) or send one value (http_statuses=<value>); http_statuses[]=<value> is accepted too.

  • includearray of strings or nullOptional

    Only lines that contain each of these texts (or any of them, with match=any): literal text of 1 to 500 characters. A search holds at most 10 terms: search, exclude and every include and exclude list count together. A list: repeat the parameter (include=<value>&include=<value>) or send one value (include=<value>); include[]=<value> is accepted too.

  • include_wordsarray of strings or nullOptional

    Only lines that contain each of these whole words: a word is bounded where its first and last characters are letters, digits or underscores (ASCII only, so café is bounded at caf). A list: repeat the parameter (include_words=<value>&include_words=<value>) or send one value (include_words=<value>); include_words[]=<value> is accepted too.

  • include_regexarray of strings or nullOptional

    Only lines that match each of these RE2 regular expressions: no lookahead, lookbehind, backreference, possessive quantifier or atomic group. At most 5 regex terms, with exclude_regex and a search with search_mode=regex. Start one with (?i) to ignore case in that term alone. A list: repeat the parameter (include_regex=<value>&include_regex=<value>) or send one value (include_regex=<value>); include_regex[]=<value> is accepted too.

  • exclude_wordsarray of strings or nullOptional

    Only lines that contain none of these whole words. A list: repeat the parameter (exclude_words=<value>&exclude_words=<value>) or send one value (exclude_words=<value>); exclude_words[]=<value> is accepted too.

  • exclude_regexarray of strings or nullOptional

    Only lines that match none of these RE2 regular expressions, as include_regex takes them. A list: repeat the parameter (exclude_regex=<value>&exclude_regex=<value>) or send one value (exclude_regex=<value>); exclude_regex[]=<value> is accepted too.

  • matchstring or nullOptional

    How the included terms combine: all (the default), a line matches every one, or any, at least one; the excluded terms always apply. Needs an included term (search, include, include_words or include_regex). search_case sets the case of every term.

    Values:allany(an open set: new values may be added)

Returns

200 OK:

The matching lines counted per time bucket.

Each failure is a problem document with a stable code; the response panel's status selector shows each one this operation can answer, and errors lists them all.