Edge Device Logs
Collect and analyze logs from your edge devices - POS terminals, IoT devices, kiosks, and any system running outside your main infrastructure.
Overview
Edge Device Logs provides:
- Centralized logging - Aggregate logs from distributed devices in one place
- Error grouping - Sentry-style fingerprinting to group similar errors
- Full-text search - Search across all log messages instantly
- Device management - Track device health and status
- Email alerts - Get notified when errors spike
Quick Start
1. Register a Device
curl -X POST https://api.simplr-ai.com/v1/edge/devices/register \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "pos-terminal-001",
"device_type": "pos",
"name": "Store #42 - Register 1",
"location": {
"name": "Downtown Store",
"address": "123 Main St"
}
}'
2. Send Logs
curl -X POST https://api.simplr-ai.com/v1/edge/logs \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"logs": [
{
"device_id": "pos-terminal-001",
"level": "info",
"message": "Transaction completed successfully",
"data": {
"transaction_id": "txn_123",
"amount": 49.99
}
},
{
"device_id": "pos-terminal-001",
"level": "error",
"message": "Payment gateway timeout",
"error": {
"type": "TimeoutError",
"code": "GATEWAY_TIMEOUT"
}
}
]
}'
Log Levels
| Level | Description |
|---|---|
debug | Detailed debugging information |
info | General operational messages |
warn | Warning conditions |
error | Error conditions |
fatal | Critical errors requiring immediate attention |
Log Categories
| Category | Use Case |
|---|---|
application | Application-level logs |
system | System/OS level events |
security | Security-related events |
performance | Performance metrics |
network | Network-related events |
hardware | Hardware status/errors |
transaction | Business transactions |
audit | Audit trail events |
Log Schema
interface EdgeLog {
device_id: string; // Required - unique device identifier
level: LogLevel; // Required - debug, info, warn, error, fatal
message: string; // Required - log message
// Optional fields
timestamp?: number | string; // ISO date or Unix timestamp (defaults to now)
category?: LogCategory; // Log category
environment?: string; // e.g., "production", "staging"
// Error details (for error/fatal levels)
error?: {
type: string; // Error class/type
stack?: string; // Stack trace
code?: string; // Error code
cause?: string; // Root cause
};
// Custom data - store any JSON
data?: Record<string, unknown>;
// Distributed tracing
trace_id?: string;
span_id?: string;
// Source location
source_file?: string;
source_line?: number;
source_function?: string;
// Tagging
tags?: string[];
}
Error Grouping
Similar errors are automatically grouped using fingerprinting. The fingerprint is generated from:
- Error type
- Normalized message (with variables like IDs, timestamps removed)
This means Payment failed for order 12345 and Payment failed for order 67890 are grouped together.
View error groups in the dashboard or via API:
curl https://api.simplr-ai.com/v1/edge/errors?org_id=YOUR_ORG_ID \
-H "Authorization: Bearer YOUR_TOKEN"
Device Types
| Type | Description |
|---|---|
pos | Point of Sale terminal |
kiosk | Self-service kiosk |
iot | IoT sensor/device |
mobile | Mobile device |
desktop | Desktop application |
server | Edge server |
gateway | Network gateway |
other | Other device type |
Pricing
Edge logs use volume-based pricing with automatic discounts at scale:
| 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 |
Included features:
- Error grouping & fingerprinting
- Full-text log search
- Device management
- Basic email alerts
- Dashboard analytics
- 30-day retention
Best Practices
Batch Your Logs
Send logs in batches rather than individually to reduce API calls:
// Good - batch multiple logs
const logs = [];
logs.push({ device_id: "pos-001", level: "info", message: "Event 1" });
logs.push({ device_id: "pos-001", level: "info", message: "Event 2" });
await fetch("/v1/edge/logs", {
method: "POST",
body: JSON.stringify({ logs })
});
Use Structured Data
Put variable data in the data field, not the message:
// Good - structured
{
message: "Transaction completed",
data: { transaction_id: "txn_123", amount: 49.99 }
}
// Bad - unstructured
{
message: "Transaction txn_123 completed for $49.99"
}
Include Trace IDs
For distributed systems, include trace IDs to correlate logs:
{
device_id: "pos-001",
level: "info",
message: "Processing payment",
trace_id: "abc123",
span_id: "def456"
}
API Reference
| Endpoint | Method | Description |
|---|---|---|
/v1/edge/logs | POST | Ingest logs (batch) |
/v1/edge/logs | GET | Query logs |
/v1/edge/logs/search | GET | Full-text search |
/v1/edge/devices/register | POST | Register device |
/v1/edge/devices | GET | List devices |
/v1/edge/devices/:id/heartbeat | POST | Device heartbeat |
/v1/edge/overview | GET | Dashboard stats |
/v1/edge/errors | GET | Error groups |
/v1/edge/trends | GET | Log volume trends |
/v1/edge/alerts | GET/POST/DELETE | Manage alerts |