Logs API
Send and search structured log data.
Send Log
Log level: debug, info, warn, error
ISO 8601 timestamp. Defaults to current time.
Additional structured data
curl -X POST https://api.itsfriday.in/v1/logs/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"level": "info",
"message": "User login successful",
"attributes": {
"user_id": "user_123",
"ip_address": "192.168.1.1"
},
"trace_id": "abc123"
}'
Response
{
"data": {
"accepted": true
}
}
Send Batch Logs
curl -X POST https://api.itsfriday.in/v1/logs/batch/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"logs": [
{
"level": "info",
"message": "Request started",
"attributes": {"request_id": "req_123"}
},
{
"level": "info",
"message": "Request completed",
"attributes": {"request_id": "req_123", "duration_ms": 45}
}
]
}'
Search Logs
Filter by attribute value
Maximum results to return
Results offset for pagination
curl -G "https://api.itsfriday.in/v1/logs/search/" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "query=login failed" \
--data-urlencode "level=error" \
--data-urlencode "from=2024-01-15T00:00:00Z" \
--data-urlencode "limit=50"
Response
{
"data": {
"logs": [
{
"timestamp": "2024-01-15T10:30:00Z",
"level": "error",
"message": "User login failed: invalid password",
"attributes": {
"user_id": "user_456",
"ip_address": "192.168.1.2",
"attempt": 3
},
"trace_id": "xyz789"
}
]
},
"meta": {
"total": 150,
"limit": 50,
"offset": 0
}
}
Get Log by ID
curl "https://api.itsfriday.in/v1/logs/log_abc123/" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"data": {
"id": "log_abc123",
"timestamp": "2024-01-15T10:30:00Z",
"level": "error",
"message": "User login failed",
"attributes": {...},
"trace_id": "xyz789"
}
}
Aggregate Logs
Get log counts grouped by field.
curl -G "https://api.itsfriday.in/v1/logs/aggregate/" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "group_by=level" \
--data-urlencode "from=2024-01-15T00:00:00Z"
Response
{
"data": {
"buckets": [
{"level": "info", "count": 15000},
{"level": "warn", "count": 500},
{"level": "error", "count": 45}
]
}
}
Log Levels
| Level | Description | When to Use |
|---|
debug | Detailed debugging info | Development only |
info | Normal operation events | User actions, requests |
warn | Warning conditions | Recoverable issues |
error | Error conditions | Failures requiring attention |