Skip to main content

Logs API

Send and search structured log data.

Send Log

level
string
required
Log level: debug, info, warn, error
message
string
required
Log message
timestamp
string
ISO 8601 timestamp. Defaults to current time.
attributes
object
Additional structured data
trace_id
string
Trace ID for correlation
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

query
string
Full-text search query
level
string
Filter by log level
from
string
Start time (ISO 8601)
to
string
End time (ISO 8601)
attributes.*
string
Filter by attribute value
limit
integer
default:"100"
Maximum results to return
offset
integer
default:"0"
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

LevelDescriptionWhen to Use
debugDetailed debugging infoDevelopment only
infoNormal operation eventsUser actions, requests
warnWarning conditionsRecoverable issues
errorError conditionsFailures requiring attention