POST/v1/logs/otlp

Export OpenTelemetry logs

Requires an API token with LOGS:SEND. Supports gzip compression.

Body parameters

resourceLogs:array | nulloptional
resource:object | nulloptional
schemaUrl:string | nulloptional
scopeLogs:array | nulloptional
scope:object | nulloptional
schemaUrl:string | nulloptional
logRecords:array | nulloptional
timeUnixNano:anyoptional
*anonymous*:stringoptional
*anonymous*:numberoptional
*anonymous*:nulloptional
observedTimeUnixNano:anyoptional
*anonymous*:stringoptional
*anonymous*:numberoptional
*anonymous*:nulloptional
severityNumber:integer | nulloptional
severityText:string | nulloptional
body:anyoptional
Log body as an OTLP AnyValue.
attributes:array | nulloptional
key:string
value:anyoptional
OTLP AnyValue.
droppedAttributesCount:integer | nulloptional
flags:integer | nulloptional
traceId:string | nulloptional
spanId:string | nulloptional
eventName:string | nulloptional

Responses

StatusMeaningDescription
200OKOTLP full success, in the request encoding
400Bad RequestInvalid OTLP export
401UnauthorizedMissing or invalid API token
403ForbiddenRequires an explicit LOGS:SEND grant
405Method Not AllowedRequires POST
413Payload Too LargeExport or record exceeds a size limit
415Unsupported Media TypeUnsupported content type or compression
429Too Many RequestsLog ingestion allowance exceeded
503Service UnavailableIngestion unavailable or delivery not confirmed

Request

POST
/v1/logs/otlp
curl --request POST \
  --url https://api.onlineornot.com/v1/logs/otlp \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"resourceLogs":[{"resource":{"attributes":[{"key":"string","value":null}],"droppedAttributesCount":4294967295},"schemaUrl":"string","scopeLogs":[{"scope":{"attributes":[{"key":"string","value":null}],"droppedAttributesCount":4294967295,"name":"string","version":"string"},"schemaUrl":"string","logRecords":[{"timeUnixNano":"string","observedTimeUnixNano":"string","severityNumber":24,"severityText":"string","body":null,"attributes":[{"key":"string","value":null}],"droppedAttributesCount":4294967295,"flags":4294967295,"traceId":"string","spanId":"string","eventName":"string"}]}]}]}'

Response

{}

Response Headers

StatusHeaderTypeFormatDescription
429Retry-AfterintegerSeconds until the next billing period

POST/v1/logs

Send JSON logs

Requires an API token with LOGS:SEND.

Body parameters

logs:object[]

Responses

StatusMeaningDescription
202AcceptedLog batch accepted for processing
400Bad RequestInvalid log batch
401UnauthorizedMissing or invalid API token
403ForbiddenRequires an explicit LOGS:SEND grant
413Payload Too LargeBatch or record exceeds its byte limit
415Unsupported Media TypeRequires uncompressed application/json
429Too Many RequestsLog ingestion allowance exceeded
500Internal Server ErrorInternal server error
503Service UnavailableIngestion unavailable or delivery not confirmed

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

POST
/v1/logs
curl --request POST \
  --url https://api.onlineornot.com/v1/logs \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"logs":[{"timestamp":"2019-08-24T14:15:22Z","level":"TRACE","message":"string","service":"string","environment":"string","attributes":{"property1":null,"property2":null},"trace_id":"string","span_id":"string"}]}'

202 Response

{
  "result": {
    "accepted": 1,
    "ids": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}

Response Headers

StatusHeaderTypeFormatDescription
429Retry-AfterintegerSeconds until the next billing period

GET/v1/logs

Search logs

Search logs by receipt time.

Requires LOGS:READ.

Header parameters

X-OnlineOrNot-Organisation:stringoptional
Public organization ID to select from an OAuth grant. Required for grants authorizing multiple organizations. Omit for single-organization grants and API tokens.

Query parameters

from:string(date-time)
Inclusive server receipt time, in RFC 3339 format.
to:string(date-time)
Exclusive server receipt time, at most one hour after from.
limit:integeroptional
Default: 50
cursor:stringoptional
project_id:anyoptional
service:stringoptional
environment:stringoptional
level:stringoptional
Accepted values: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL"
q:stringoptional
Case-insensitive literal substring of the log message.

Responses

StatusMeaningDescription
200OKMatching logs and a continuation cursor
400Bad RequestInvalid or unbounded search request
401UnauthorizedMissing or invalid credentials
403ForbiddenInsufficient permissions
404Not FoundProject not found
500Internal Server ErrorInternal server error
503Service UnavailableLog search unavailable

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

GET
/v1/logs
curl --request GET \
  --url 'https://api.onlineornot.com/v1/logs?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": {
    "logs": [
      {
        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
        "project_id": "a1b2c3d4e5f6g7h8",
        "timestamp": "2019-08-24T14:15:22Z",
        "received_at": "2019-08-24T14:15:22Z",
        "level": "TRACE",
        "message": "string",
        "service": "string",
        "environment": "string",
        "attributes": {
          "property1": null,
          "property2": null
        },
        "trace_id": "string",
        "span_id": "string"
      }
    ],
    "next_cursor": "string",
    "scanned_bytes": 0
  },
  "success": true,
  "errors": [],
  "messages": []
}

GET/v1/logs/usage

Read log and trace usage

Read combined log and trace ingestion usage for the current billing period.

Requires LOGS:READ.

Header parameters

X-OnlineOrNot-Organisation:stringoptional
Public organization ID to select from an OAuth grant. Required for grants authorizing multiple organizations. Omit for single-organization grants and API tokens.

Responses

StatusMeaningDescription
200OKCurrent log usage and allowance
400Bad RequestInvalid request
401UnauthorizedMissing or invalid credentials
403ForbiddenInsufficient permissions
500Internal Server ErrorInternal server error
503Service UnavailableLog usage unavailable

Response Schema

result:object
success:boolean
Whether the API call was successful
errors:object[]
messages:object[]

Request

GET
/v1/logs/usage
curl --request GET \
  --url https://api.onlineornot.com/v1/logs/usage \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'

Response

{
  "result": {
    "period_start": "2019-08-24T14:15:22Z",
    "period_end": "2019-08-24T14:15:22Z",
    "used_bytes": 0,
    "used_records": 0,
    "limit_bytes": 5000000000,
    "remaining_bytes": 0,
    "retention_days": 30
  },
  "success": true,
  "errors": [],
  "messages": []
}

Was this page helpful?