Skip to main content

Endpoint

GET /v1/logs/search

Query Parameters

ParameterTypeDefaultDescription
qstringRequiredSearch query (min 2 characters)
fieldsstringmessageComma-separated fields to search
limitnumber50Number of results (max 500)
offsetnumber0Results to skip
levelstring-Filter by log level
sourcestring-Filter by source
environmentstring-Filter by environment
datasetstring-Filter by dataset
fromnumber-Start timestamp (Unix ms)
tonumber-End timestamp (Unix ms)

Searchable Fields

  • message - Log message (default)
  • errorName - Error class/name
  • errorStack - Error stack trace
  • data - JSON data field

Search Syntax

Simple word search (case-insensitive):
payment

Multiple Terms (AND)

All terms must be present:
payment failed
Match exact phrase:
"payment failed"
Match any of the terms:
payment OR checkout

Exclude Terms

Exclude logs containing a term:
payment -refund

Combined

"payment failed" error -test

Response

{
  "logs": [
    {
      "id": "log_abc123",
      "timestamp": 1704067200000,
      "level": "error",
      "message": "Payment failed: insufficient funds",
      "source": "payment-service",
      "environment": "production"
    }
  ],
  "query": {
    "raw": "payment failed",
    "parsed": {
      "required": ["payment", "failed"],
      "phrases": [],
      "excluded": [],
      "optional": []
    },
    "fields": ["message"]
  },
  "pagination": {
    "limit": 50,
    "offset": 0,
    "count": 15,
    "hasMore": false
  }
}

Examples

Basic Search

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/search?q=error" \
  -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Search Specific Fields

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/search?q=timeout&fields=message,errorStack" \
  -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Phrase Search

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/search?q=%22database%20connection%22" \
  -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Exclude Terms

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/search?q=error%20-debug" \
  -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Combined Filters

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/search?q=payment&level=error&source=payment-service&environment=production" \
  -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Time Range

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/search?q=timeout&from=1704067200000&to=1704153600000" \
  -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Error Responses

401 Unauthorized - Invalid or missing API key
{
  "error": "Invalid API key"
}
How to resolve: Ensure your Authorization or X-API-Key header is included and valid. See Authentication for details. 400 Bad Request - Invalid query
{
  "error": "Search query must be at least 2 characters"
}
How to resolve: The q parameter must be at least 2 characters long. Provide a longer search query. 500 Internal Server Error:
{
  "error": "Search failed"
}
How to resolve: Retry the request. If the error persists, try simplifying the query or reducing the number of search fields.

Search Tips

  1. Start specific - Use specific terms to narrow results
  2. Use phrases - Wrap multi-word searches in quotes for exact matches
  3. Exclude noise - Use -term to filter out irrelevant results
  4. Search errors - Add errorStack to fields when debugging exceptions
  5. Combine with filters - Use level=error to focus on errors only
  6. Time scope - Use from/to to search specific time periods

Performance

  • Search defaults to the message field for best performance
  • Adding more fields (especially data) increases query time
  • Use filters (level, source, etc.) to reduce the search space
  • For large result sets, use pagination with reasonable limits