Edge Device Logs API
Ingest and query logs from edge devices like POS terminals, IoT sensors, and distributed systems.
Ingest Logs
POST /v1/edge/logs
Send logs from edge devices. Supports batch ingestion.
Request
curl -X POST https://api.simplr-ai.com/v1/edge/logs \
-H "X-API-Key: sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"logs": [
{
"device_id": "pos-001",
"level": "info",
"message": "Transaction completed",
"category": "transaction",
"data": {
"transaction_id": "txn_123",
"amount": 49.99
}
}
]
}'
Log Object
| Field | Type | Required | Description |
|---|---|---|---|
device_id | string | Yes | Unique device identifier |
level | string | Yes | Log level: debug, info, warn, error, fatal |
message | string | Yes | Log message |
timestamp | string/number | No | ISO date or Unix timestamp (defaults to now) |
category | string | No | Log category |
environment | string | No | Environment name |
error | object | No | Error details for error/fatal logs |
error.type | string | No | Error type/class |
error.stack | string | No | Stack trace |
error.code | string | No | Error code |
data | object | No | Custom JSON data |
tags | string[] | No | Tags for filtering |
trace_id | string | No | Distributed trace ID |
span_id | string | No | Span ID |
Response
{
"success": true,
"message": "Logs received",
"content": {
"received": 1,
"processed": 1
}
}
Register Device
POST /v1/edge/devices/register
Register a new edge device.
Request
curl -X POST https://api.simplr-ai.com/v1/edge/devices/register \
-H "X-API-Key: sk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"device_id": "pos-001",
"device_type": "pos",
"name": "Register 1",
"firmware_version": "2.1.0",
"location": {
"name": "Downtown Store",
"address": "123 Main St"
},
"tags": ["retail", "high-volume"]
}'
Device Types
pos- Point of Sale terminalkiosk- Self-service kioskiot- IoT sensor/devicemobile- Mobile devicedesktop- Desktop applicationserver- Edge servergateway- Network gatewayother- Other device type
Device Heartbeat
POST /v1/edge/devices/:device_id/heartbeat
Send a heartbeat to indicate device is online.
curl -X POST https://api.simplr-ai.com/v1/edge/devices/pos-001/heartbeat \
-H "X-API-Key: sk_live_xxxxx"
Query Logs
GET /v1/edge/logs
Query logs with filters. Requires portal authentication.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
org_id | string | Organization ID (required) |
page | number | Page number (default: 1) |
limit | number | Results per page (default: 50) |
start_date | string | Filter from date (ISO 8601) |
end_date | string | Filter to date (ISO 8601) |
device_id | string | Filter by device |
level | string | Filter by level (comma-separated) |
category | string | Filter by category |
environment | string | Filter by environment |
error_fingerprint | string | Filter by error group |
Response
{
"success": true,
"content": {
"logs": [...],
"pagination": {
"page": 1,
"limit": 50,
"total": 1234,
"pages": 25
}
}
}
Search Logs
GET /v1/edge/logs/search
Full-text search across log messages.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
org_id | string | Organization ID (required) |
q | string | Search query (required) |
page | number | Page number |
limit | number | Results per page |
start_date | string | Filter from date |
end_date | string | Filter to date |
Get Error Groups
GET /v1/edge/errors
Get Sentry-style error groups with fingerprinting.
Response
{
"success": true,
"content": [
{
"fingerprint": "abc123",
"error_type": "TimeoutError",
"message": "Payment gateway timeout",
"count": 47,
"affected_devices": 3,
"first_seen": "2024-01-15T10:00:00Z",
"last_seen": "2024-01-15T14:30:00Z",
"environments": ["production"]
}
]
}
Get Overview
GET /v1/edge/overview
Dashboard statistics for edge logging.
Response
{
"success": true,
"content": {
"logs": {
"total": 50000,
"by_level": [
{ "level": "info", "count": 45000 },
{ "level": "error", "count": 500 }
]
},
"devices": {
"total": 25,
"active": 22,
"with_errors": 3
},
"errors": {
"total": 500,
"unique_types": 12,
"error_rate": 1.0
},
"trends": {
"logs_24h": 5000,
"logs_24h_change": 12.5
}
}
}
Get Trends
GET /v1/edge/trends
Log volume trends over time.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
org_id | string | Organization ID (required) |
start_date | string | Start date |
end_date | string | End date |
granularity | string | hour or day (default: day) |
Pricing
Edge logs use volume-based pricing:
| Monthly Volume | Credits per 1,000 logs |
|---|---|
| 0 - 10,000 | 1.0 |
| 10,001 - 100,000 | 0.8 |
| 100,001 - 1,000,000 | 0.5 |
| 1,000,000+ | 0.3 |