API Reference

The AstraLog Ingestion API is a RESTful service that accepts JSON-formatted log batches. All requests must be authenticated using a Bearer token.

Base URL

The default base URL for the ingestion engine is:

  • http://localhost:8080 (Local)
  • https://ingest.astralog.cloud (Production)

POST /v1/drain

Ingests a batch of log messages into the pipeline.

Authentication

All requests must include the following header: Authorization: <YOUR_AUTH_TOKEN>

Request Body

The request must be a JSON object containing an array of logs.

FieldTypeDescription
logsArrayAn array of log objects to be ingested.

Log Object Structure

FieldTypeRequiredDescription
project_idStringYesUnique identifier for the organization or project.
timestampStringYesEvent time (Supports RFC3339, ISO8601, and SQL formats).
levelStringYesSeverity level (e.g., info, error, debug).
serviceStringYesThe name of the microservice or process.
messageStringYesThe primary log message content.
metadataObjectNoAny key-value pairs of additional context.

Example Request (cURL)

curl -X POST https://ingest.astralog.cloud/v1/drain \
  -H "Authorization: my-secret-token" \
  -H "Content-Type: application/json" \
  -d '{
    "logs": [
      {
        "project_id": "org-xyz",
        "timestamp": "2024-05-31T15:30:45Z",
        "level": "info",
        "service": "api-gateway",
        "message": "User logged in",
        "metadata": { "user_id": 123, "ip": "1.1.1.1" }
      }
    ]
  }'

Responses

200 Accepted

{
  "status": "accepted"
}

401 Unauthorized The provided Authorization header is missing or incorrect.

400 Bad Request The request body is not valid JSON or contains malformed data.


Health Checks

GET /health (Internal)

Used by load balancers and orchestrators (like Kubernetes) to verify the service is alive.

Response: 200 OK


Best Practices

  1. Batch Size: For optimal performance, we recommend sending batches of 100 to 500 logs per request.
  2. Concurrency: Use multiple concurrent HTTP connections if you are ingesting more than 100k logs per second from a single source.
  3. Timeouts: Configure your clients with a 10-second timeout to ensure the pipeline remains non-blocking during network congestion.