Skip to main content

Sending logs

How your game server sends Game Log records: the one endpoint, realtime batches, full-log files and the errors. Sign every request as described in Authentication. Samples to download: send.js, upload-full-log.js and sign.js (needed by the other two; keep the three files in one folder).

Realtime batch vs full-log file​

You can send the same log type in two ways. Both use the same URL; the Content-Type header decides which one Alogame applies.

Realtime batchFull-log file
What it isA few records, sent as they happenAll records of a log type for a period, in one gzip file
When to useregister, login, logout, recharge, ccu: within 15 minutes of the event. money_flow, item_flow, user_snapshot, mission, ad_revenue: at least once a dayOnce a day after the day ends, for each of the 8 required log types; and whenever you need to correct data
RequestPOST the URL below with Content-Type: application/jsonPOST the same URL with Content-Type: application/x-ndjson and Content-Encoding: gzip
BodyA JSON array of 1–1000 recordsgzip of NDJSON: one record per line
Response200 { accepted, duplicate, flagged, rejected } straight away202 { batch_id, status: "received" }; Alogame processes the file afterwards
Record that already existsThe stored record is kept (counted as duplicate)The record in the file overwrites the stored one: the file wins over realtime. One exception: a record whose key is stored under another day is kept
Size limitBody up to 5 MBFile up to 512 MB
When it shows up in KPIAs soon as Alogame has stored the recordsAfter Alogame has processed the file; a day is closed at 06:00 GMT+7 of the next day and shows as final at the next refresh, about 08:00

Send both: realtime is fast, the file makes it correct. To correct data, send a file.

Which one, when:

  1. During the day: send register, login, logout, recharge and ccu as realtime batches, within 15 minutes of the event. The 200 response tells you at once which records were rejected.
  2. Other types: send money_flow, item_flow, user_snapshot, mission and ad_revenue as batches at least once a day.
  3. After the day ends: send one file per required log type, between 00:00 and 06:00 GMT+7 of the next day. This is the complete copy; it also covers records that were lost or sent twice.
  4. To correct data: send a file again. Its values replace the stored ones, except for the cross-day case below.

Endpoint​

MethodPathUse
POST{BASE_URL}/ingest/v1/games/{game_id}/logs/{log_type}?client_id=&schema_version=Realtime batch or full-log file, chosen by Content-Type
  • {game_id} is your game id and {log_type} is one of register, login, logout, recharge, ccu, money_flow, item_flow, user_snapshot, mission, ad_revenue. An unknown {log_type} returns 404 UNKNOWN_LOG_TYPE.
  • client_id (optional, 1–64 characters, default default): use default unless Alogame told you that your game runs several client builds with separate schemas.
  • schema_version (required, integer ≥ 1): the version of the column list your records follow. Version 1 is the column list in Log types.
  • Both parameters go in the query string, for batches and for files, never in the body. The query is part of the signature.

Body of a request​

The body carries only records. Each record is a JSON array of values in column order, not an object. A batch is an array of records:

[
["acc-1001", "role-1", "Hero", "VN", "2026-11-02 10:15:00", "google", "s1", "10.0.0.1", "Android", "14", "dev-1", "Pixel 8"],
["acc-1002", "role-2", "Mage", "VN", "2026-11-02 10:15:03", "apple", "s1", "10.0.0.2", "iOS", "17", "dev-2", "iPhone 15"]
]

This is a login batch. The values of the first record, in the column order of login:

#ColumnValue above
1account_idacc-1001
2role_idrole-1
3role_nameHero
4country_codeVN
5login_time2026-11-02 10:15:00
6login_channelgoogle
7server_ids1
8client_ip10.0.0.1
9os_platformAndroid
10os_version14
11device_iddev-1
12device_namePixel 8

A file holds the same records, one per line, with no surrounding brackets and no commas between lines:

["acc-1001","role-1","Hero","VN","2026-11-02 10:15:00","google","s1","10.0.0.1","Android","14","dev-1","Pixel 8"]
["acc-1002","role-2","Mage","VN","2026-11-02 10:15:03","apple","s1","10.0.0.2","iOS","17","dev-2","iPhone 15"]

Sending a batch​

// send.js (excerpt)
const body = JSON.stringify(records); // [[...], [...]]
const ts = Math.floor(Date.now() / 1000);
const url = `/ingest/v1/games/${GAME_ID}/logs/${logType}?client_id=default&schema_version=1`;
const res = await fetch(`${BASE_URL}${url}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Key-Id': KEY_ID, 'X-Timestamp': String(ts), 'X-Signature': sign(SECRET, ts, 'POST', url, body),
},
body,
});
const result = await res.json(); // { accepted, duplicate, flagged, rejected: [{ index, reason_code }] }

Download the scripts, then run the whole sample against your sandbox: GAME_LOG_BASE_URL=… GAME_LOG_GAME_ID=… GAME_LOG_KEY_ID=… GAME_LOG_SECRET=… node send.js. It sends one login and one recharge batch and prints each result.

Resending is safe. Records are de-duplicated on their duplicate key (Log types). A record that is already stored is kept and comes back as duplicate. Resend a whole batch after a timeout or a 5xx. Retry with exponential backoff; do not retry 4xx other than 429.

Per-record problems are not HTTP errors: they come back in rejected of the 200 response (Log reference).

Errors of a batch​

StatuscodeMeaningAction
400INVALID_BODYThe body is not a JSON array of 1–1000 records, or client_id / schema_version in the query is missing or malformedFix the request
401INVALID_SIGNATUREUnknown key, revoked key, or the signature does not match the method, path, query or bodyCheck key, secret, and that you sign the exact path, query and bytes you send
401STALE_TIMESTAMPX-Timestamp is more than 300 s from Alogame's clockSync your clock. Send X-Timestamp in seconds since 1970; a value in milliseconds is also rejected as stale
403KEY_GAME_MISMATCHThe key belongs to another game than {game_id}Use the right key
403REALTIME_DISABLEDRealtime is switched off for your gameSend files instead; contact Alogame to switch realtime on
404UNKNOWN_GAME / UNKNOWN_LOG_TYPE{game_id} is not registered, or Game Log is switched off for this game / unknown {log_type}Check the URL; if it is correct, ask the Alo team whether Game Log is enabled for your game
413PAYLOAD_TOO_LARGEBody over 5 MBSplit the batch
429RATE_LIMITEDMore than 600 requests per rolling 60 seconds for this key (Alogame can set another limit for your game)Send fewer, larger batches. Requests that were rejected also count against the limit, so after a 429 wait most of a minute before retrying

Error bodies are { "code": "…", "message": "…" }. Requests rejected with 401 are never stored.

Sending a file​

For each of the eight required log types, send the full log of day D after D ends (from 00:00 GMT+7 of D+1) and before 06:00 GMT+7 of D+1. If no file of a required log type arrives in that window, Alogame raises an alert. Alogame does not check that a file is complete: the two sides trust each other, so send everything you have for the day.

  1. Build the file. Write one record (a JSON array) per line, same columns and order as realtime, then gzip the whole file. Save it as .ndjson.gz.
  2. Hash the compressed file. Compute the SHA-256 of the compressed bytes (not of the NDJSON) as lower-case hex.
  3. Sign. The fifth value of the signature string is that same hash.
  4. POST to the endpoint with Content-Type: application/x-ndjson, Content-Encoding: gzip, Content-Length, and X-Content-Sha256 set to the hash. Alogame checks the signature before it accepts the body, so compute the hash first, then upload.
  5. Read the response. 202 { batch_id, status: "received" } means Alogame has the file and will process it afterwards. Keep the batch_id. A 202 does not say the file is valid. Records that fail validation are stored in the rejects table with the same reason codes as realtime, and never stop the rest of the file; they do not appear in the response.
  6. Know what can still fail later. Some problems are found only while the file is processed, after you have your 202: a line longer than 1 MiB (a record is one JSON array, so a file that is not NDJSON usually breaks this), a body that is not gzip, or a truncated gzip. The batch is then marked failed and Alogame's data team is alerted; records read before the failure stay applied. There is nothing to poll: ask the Alo team for the status of your batch_id. Check the file before you send it, for example with gzip -t login.ndjson.gz, and send it again after a fix (resending is safe).
// upload-full-log.js (excerpt)
const body = fs.readFileSync(file); // already gzipped NDJSON
const sha = crypto.createHash('sha256').update(body).digest('hex'); // hash of the compressed bytes
const url = `/ingest/v1/games/${GAME_ID}/logs/${logType}?client_id=default&schema_version=1`;
const res = await fetch(`${BASE_URL}${url}`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-ndjson', 'Content-Encoding': 'gzip', 'X-Content-Sha256': sha,
'X-Key-Id': KEY_ID, 'X-Timestamp': String(ts), 'X-Signature': sign(SECRET, ts, 'POST', url, body),
},
body,
});

Run it with node upload-full-log.js login ./login.ndjson.gz (same environment variables as send.js).

  • Duplicates: a record that already exists is overwritten by the file's values, so late, lost or duplicated realtime records do not affect the final KPIs.
  • Cross-day exception: for register, recharge, money_flow and item_flow, the duplicate key does not contain a date. If a record in your file has a key that is already stored under a different day, the stored record is kept and the file's record is counted as a duplicate. So a correction that moves such a record across midnight (for example a recharge_time or create_time corrected from 23:58 to 00:02) cannot be fixed by sending a file. Contact the Alo team to have it corrected.
  • Any days in one file: each record is stored under the day of its own timestamp, so one file may contain records of any days.
  • Big days: if a day is too big for one file (over 512 MB), send it as several independent files. Each file must be complete in itself, which is a gzip of whole lines.
  • Concurrent uploads: Alogame limits how many file uploads of your game run at the same time (4 by default; Alogame can change it for your game). This is a maximum: you do not have to send 4 at a time. Over the limit you get 429 TOO_MANY_UPLOADS before the body is read: wait and retry. A limit of 0 switches file uploads off (403 FULL_LOG_UPLOAD_DISABLED).
  • Content-Length: always send it. A file over 512 MB is refused with 413 before it is read; a request without Content-Length (chunked upload) gets 411.
  • Final day: a day is closed at 06:00 GMT+7 of the next day, whichever files arrived, and shows as final at the next scheduled refresh, about 08:00 GMT+7. A later file still updates the days it contains.
  • Correcting data: to correct data, send a file; its values replace the stored ones, except for the cross-day exception.

Errors of a file​

StatuscodeMeaningAction
400INVALID_BODYclient_id or schema_version in the query is missing or malformedFix the query
401INVALID_SIGNATUREX-Content-Sha256 is missing, is not a SHA-256 in hex, or differs from the hash of the body; or the signature is wrongHash the compressed bytes, sign with that hash, and send the file again; nothing was stored
401STALE_TIMESTAMPX-Timestamp is more than 300 s from Alogame's clockSync your clock
403KEY_GAME_MISMATCHThe key belongs to another game than {game_id}Use the right key
403FULL_LOG_UPLOAD_DISABLEDFile uploads are switched off for your gameContact Alogame
404UNKNOWN_GAME / UNKNOWN_LOG_TYPEAs for batchesCheck the URL
411LENGTH_REQUIREDNo valid Content-Length headerSend Content-Length; do not upload chunked
413PAYLOAD_TOO_LARGEFile over 512 MBSplit it into several files
422UNKNOWN_SCHEMA_VERSION / LOG_TYPE_NOT_DECLAREDAlogame has no locked schema for this client_id + schema_version + log_type. Checked before any byte is accepted; nothing is storedAsk the Alo team to declare the schema, then upload again
429TOO_MANY_UPLOADSToo many file uploads of your game are runningWait and retry
429RATE_LIMITEDToo many requests for this keyBack off
503STORAGE_UNAVAILABLEAlogame could not store the fileRetry later
503QUEUE_UNAVAILABLEAlogame stored the file but could not queue its processingSend the file again; resending is safe, the same records overwrite themselves

Implementation checklist​

  • Every timestamp is GMT+7 yyyy-MM-dd HH:mm:ss.
  • Records are arrays in column order and carry exactly the declared number of columns.
  • client_id and schema_version are in the query, not in the body; the query is signed.
  • Realtime types reach Alogame within 15 minutes; the other types are sent at least once a day.
  • The full log of day D, for each of the 8 required log types, is sent between 00:00 and 06:00 GMT+7 of D+1, with the SHA-256 of the compressed bytes in X-Content-Sha256.
  • recharge is sent only for completed payments, with the SDK transaction_id.
  • ccu is sent every 5 minutes, one record per server per platform, same event_time for all servers.
  • user_snapshot is taken at 23:59:59 GMT+7 for every active character and currency.
  • No secret is committed to source control or written to logs.

Alogame then verifies your data over three consecutive days using the acceptance checklist.