> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alshival.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging and ingestion

> Structured resource logging via SDKs or direct HTTP

Cloud logs can be sent with Python SDK, Node.js SDK, or direct HTTP.

Use `ALERT` for high-priority incidents.

Disable SDK cloud forwarding with `ALSHIVAL_CLOUD_LEVEL=NONE`.

Use the DevTools Resource Details page's **Resource URL** as `ALSHIVAL_RESOURCE` for targeting. This supports both owned and shared resources.

Supported cloud forwarding levels: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `ALERT`, `NONE`.

## Payload format

```json theme={null}
{
  "logs": [
    {
      "level": "alert",
      "message": "payment queue backed up",
      "ts": "2026-02-22T00:00:00+00:00",
      "extra": {
        "queue": "payments",
        "depth": 921,
        "region": "us-central"
      }
    }
  ]
}
```

## SDK examples

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    import alshival

    alshival.configure(
        username='your_username',
        api_key='your_api_key',
        resource='https://alshival.dev/u/resource_owner_username/resources/resource_uuid/',
        cloud_level='INFO',
    )

    alshival.log.info('worker online')
    alshival.log.alert('cpu sustained above 95%', extra={'host': 'worker-2'})
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    const alshival = require('@alshival.ai/alshival');

    alshival.configure({
      username: 'your_username',
      apiKey: 'your_api_key',
      resource: 'https://alshival.dev/u/resource_owner_username/resources/resource_uuid/',
      cloudLevel: 'INFO',
    });

    alshival.log.info('worker online');
    alshival.log.alert('cpu sustained above 95%', { extra: { host: 'worker-2' } });
    ```
  </Tab>
</Tabs>

## Common error codes

* `400 invalid_json`: malformed JSON payload
* `400 invalid_resource`: username/resource mismatch
* `401 invalid_credentials`: invalid or revoked key
* `403 forbidden`: authenticated but not authorized
