How-to guideobservability10–12 minIntermediate
Sending Structured Logs into TG2G IngestAPI
Learn how to send logs to the IngestAPI, including schema recommendations and batching.
SRELast updated 2025-11-26
logsingestjsonobservability
Share:
Prerequisites
- IngestAPI key from **Portal → Settings → API**.
- Ability to send HTTPS POST requests from your apps or log pipeline.
- Basic familiarity with JSON.
IngestAPI endpoint and schema
The IngestAPI accepts batches of log entries grouped by logical source. The endpoint is:
POST https://ingest.techguys2go.com/v1/logs
Each request contains a top-level source, optional entity, and an array of logs.
Basic logs payload
{
"source": "checkout-service",
"entity": {
"name": "checkout-service",
"kind": "service",
"tags": ["prod", "payments"]
},
"logs": [
{
"timestamp": "2024-01-01T12:00:00Z",
"level": "error",
"message": "Payment gateway timeout",
"requestId": "abc-123",
"region": "us-east-1"
},
{
"timestamp": "2024-01-01T12:00:03Z",
"level": "info",
"message": "Retry succeeded",
"requestId": "abc-123"
}
]
}Log levels and recommended fields
TG2G does not enforce a specific log level vocabulary, but we recommend sticking to a small, consistent set such as `debug`, `info`, `warn`, `error`, and `fatal`. Helpful fields to include: - `timestamp` (ISO-8601) - `level` - `message` - `requestId` or correlation ID - `region` or `cluster` - Any domain-specific attributes that matter for triage
Batching and throughput tips
- Batch 20–500 log entries per request for better throughput.
- Use gzip compression at the HTTP level if you are shipping very high volumes.
- Avoid sending extremely large stack traces with every line as a separate log; group them where possible.