Skip to content

Logging

Ingest structured logs and run full-text log search across your application.

1. Overview

Base path: https://api.infrai.cc/v1/logs
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# Call any /v1/logs capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/logs/... \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json"

2. Methods (2)

2.1logs.ingest

POST /v1/logs/ingest

Ingest log entries in batches

Parameters

NameTypeRequiredDescription
entriesLogEntry[]
Required
Array of log entries
≥ 1 item
idempotency_keystringOptionalIdempotent keys, used to avoid repeated writes

Returns

AcceptedResult
NameTypeDescription
acceptedintegerNumber of items accepted for processing
≥ 0

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/logs/ingest \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entries": [{"message": "hello", "level": "debug"}]}'

2.2logs.search

GET /v1/logs/search

Search log

Parameters

NameTypeRequiredDescription
qstringOptionalSearch keywords
filterRecord<string, unknown>OptionalFilter Conditions (Observation Filter DSL)
sincestringOptionalstart time
format: date-time
untilstringOptionalend time
format: date-time
cursorstringOptionalpaging cursor
limitnumberOptionalReturn quantity per page
1–100default: 20

Returns

LogQueryResult
NameTypeDescription
itemsobject[]Array of result items in this page
items[].messagestringDetailed message content
items[].level"debug" | "info" | "warning" | "error" | "fatal"Severity or log level (e.g. info, warn, error)
items[].timestampstring | nullDefaults to ingest time if omitted.
format: date-time
items[].servicestring | nullService name that emitted the log
items[].environmentstring | nullDeployment environment (e.g. production, staging)
items[].trace_idstring | nullCorrelate with a distributed trace.
items[].span_idstring | nullSpan identifier for tracing
items[].attributesobject | nullArbitrary structured fields.
next_cursorstring | nullOpaque cursor to fetch the next page; null/absent if this is the last page
totalintegerTotal number of items across all pages
≥ 0

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/logs/search \
  -H "Authorization: Bearer $INFRAI_API_KEY"

3. All capabilities

Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.

logs.ingestPOST /v1/logs/ingest

Ingest a batch of log entries.

Parameters (2)
NameTypeRequiredDescription
entriesobject[]RequiredLog entries to ingest
≥ 1 item
idempotency_keystring | nullOptionalDedup key for the whole batch (route is idempotent:true).
logs.searchGET /v1/logs/search

Search logs by keyword and time range.

Parameters (10)
NameTypeRequiredDescription
qstring | nullOptionalFull-text query over message.
filterobject | nullOptionalStructured predicate over level / service / environment / trace_id / attributes.
levelstring | nullOptionalFilter by normalized log level.
servicestring | nullOptionalFilter by service name.
environmentstring | nullOptionalFilter by deployment environment.
trace_idstring | nullOptionalFilter by trace identifier.
sincestring | nullOptionalISO 8601 date when the current tier or state became effective
format: date-time
untilstring | nullOptionalISO 8601 date/time for the end of the query range
format: date-time
cursorstring | nullOptionalOpaque cursor for pagination; pass to fetch the next page
limitintegerOptionalMaximum number of items to return per page
1–100default: 20

4. End-to-end example

A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.

A copy-paste-runnable single-file Python program (stdlib only, no SDK): set your INFRAI_API_KEY, run it, and walk this module's core flow with REAL billed calls — later steps reuse real fields returned by earlier ones. The 12-line helper is the entire integration.

python
#!/usr/bin/env python3
"""Infrai · logs — runnable real-app example (single file, zero deps).

Copy this file, set your key, run it: every step is a REAL call to
api.infrai.cc, billed at the real (tiny) per-call price, printing the
live JSON response. Get a key at https://infrai.cc/login (Google/
GitHub sign-in grants $2 free credit); add funds at
https://infrai.cc/billing. No SDK — the 12-line helper below is the
entire integration."""
import json
import os
from urllib import error, request

KEY = os.environ.get("INFRAI_API_KEY") or "ifr_..."  # <- your key
BASE = "https://api.infrai.cc"


# Same raw HTTPS POST/GET as every per-method example on this page —
# wrapped once for reuse. There is nothing else to it: no SDK.
def infrai(method, path, body=None):
    req = request.Request(
        BASE + path, method=method,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"Authorization": f"Bearer {KEY}",
                 "Content-Type": "application/json"})
    try:
        with request.urlopen(req, timeout=60) as r:
            return json.loads(r.read())
    except error.HTTPError as e:
        return json.loads(e.read())


def show(label, resp):
    print(f"\n== {label} ==")
    print(json.dumps(resp, indent=2, ensure_ascii=False))
    return resp


# 1) logs.ingest — POST /v1/logs/ingest · Ingest a batch of log entries.
r1 = show("logs.ingest", infrai("POST", "/v1/logs/ingest", {"entries":[{"message":"hello","level":"debug"}]}))

# 2) logs.search — GET /v1/logs/search · Search logs by keyword and time range.
r2 = show("logs.search", infrai("GET", "/v1/logs/search"))

5. Developer guides

Move from endpoint details to complete workflows, production patterns and troubleshooting guides verified against the live API.

Logging developer guides