Send a log
POST / stores one log: the fields, their limits and an example.
POST / stores one log. Send it with an API token.
Request
curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \
-d '{
"app": "Demo project",
"type": "error",
"schema": "Reports",
"message": "Report export failed: timeout",
"userid": "u101",
"username": "John Smith",
"url": "https://app.example.com/reports/",
"ip": "198.51.100.7",
"ua": "Chrome 131 (Windows)",
"data": "{\"report\":\"monthly\",\"timeout\":30000}"
}' \
https://logs.example.com/Response 200:
{"success":true}Fields
| Field | Required | Max. length | What it holds |
|---|---|---|---|
app | yes | 40 | The name of the app, for example Demo project. Shown in App. |
type | no | info, warning, error or success, in lower case. Any other value, or none, is stored as info. | |
message | no | 500 | The text of the log. |
schema | no | 50 | The part of the app, for example Orders or Users. |
userid | no | 30 | The ID of the user. |
username | no | 50 | The name of the user. |
url | no | 100 | The address the user was on. |
ip | no | 80 | The IP address of the user. |
ua | no | 30 | The device or browser, shown in Device. |
data | no | Extra data as a JSON string. Shown formatted in Log detail. | |
reference | no | 50 | Your own reference, for example an order number. Only in the downloaded file. |
date | no | The time of the event, as an ISO date. Only in the downloaded file. Without it, the time of arrival is used. | |
clientside | no | true if the event happened in the browser. Only in the downloaded file. |
OpenLogger adds id and dtcreated, the time it received the log. Other fields are ignored.
Rules
- A longer value is cut to the maximum length, without an error.
datamust be a string. Turn an object into JSON first, for example withJSON.stringify()in JavaScript. An object sent as it is gets stored empty.- Without
app, the request fails with400. See Errors.