JSON via HTTP/S
Ship JSON logs using HTTP/S to your Logit.io Stack
If you have logs that are in JSON format, you can send them to your Logit.io Stack using the HTTP/S API. This is a great way to send logs from applications that do not have a native integration with Logit.io or for custom applications.
Logs
Send JSON logs to your Logit.io Stack via your Logit.io API endpoint.
Install Integration
Requirements
- Valid JSON content
- API key, sent in the headers. If you are logged into your Logit.io account the API key and endpoint should be automatically populated in the examples below.
- Content-Type header set as application/json
- Either POST or PUT to https://@logitApiEndpoint/v2
Send a single JSON log using curl
curl -i -H "ApiKey: @apikey" -i -H "Content-Type: application/json" -H "LogType: json" https://@logitApiEndpoint/v2 -d '{"test":"test","example": { "a": 1, "b": 2 } }'
Response from Logit.io
You should expect to receive a 202 ACCEPTED response code for a successful message
HTTP/1.1 202 ACCEPTED
Content-Type: application/json
Content-Length: 39
Connection: keep-alive
Server: Logit-API-Server
Date: Wed, 27 Mar 2025 14:34:39 GMT
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
{"message":"Message Received, Thanks"}
Send JSON log files using curl
It is also possible to test sending logs in a JSON file to Logit.io.
Create a new file in the same directory as your command prompt and copy the snippet below and save it as sample.json
.
{
"name": "Jason",
"city": "Jakarta",
"display": "Hello there from JSON file",
"value": 5
}
The following command should now be entered into the command prompt, this will send the file to Logit.io:
curl -i -H "ApiKey: @apikey" -i -H "Content-Type: application/json" -H "LogType: json" https://@logitApiEndpoint/v2 -d @sample.json
Launch Logs to View Your Data
Launch LogsHow to diagnose no data in Stack
If you don't see data appearing in your stack after following this integration, take a look at the troubleshooting guide for steps to diagnose and resolve the problem or contact our support team and we'll be happy to assist.