HTTPS Endpoint API: Sending Logs
Site24x7 allows you to send logs to AppLogs through an HTTPS endpoint. There are three ways to send logs:
HTTPS single-line
You can send single-line logs to Site24x7's HTTPS endpoint in JSON format.
Testing:
Make sure your logs are sending correctly by running your own application to send logs or by using the example below.
Example:
Open a command prompt, and enter the following cURL command with JSON values.
curl -X POST -H "Content-Type: application/json" -d "{\"_zl_timestamp\":1621246428715,\"LogLevel\":\"WARN\",\"Message\":\"Batch of prepared statements\"}" https://logc.site24x7.com/event/receiver?token=<TokenValue>
Here, TokenValue will be available at the particular Log type page after enabling API upload. The 'zl_timestamp' field is mandatory in the log lines and it should be in unix timestamp format.
You can verify and confirm that AppLogs has received your test data using the response code 200 OK.
To view the logs, search with the log type in the AppLogs page. It may take a couple minutes to index the log.
HTTPS multi-line
You can send multi-line logs to Site24x7's HTTPS endpoint in JSON format. You can also send multi-line exception traces.
Testing:
Make sure your logs are sending correctly by running your own application to send logs, or by using the example below.
Example:
Open a command prompt and enter the following cURL command with JSON values.
curl -X POST -H "Content-Type: application/json" -d "[{\"_zl_timestamp\":1621246428715,\"LogLevel\":\"WARN\",\"Message\":\"Batch of prepared statements\"},{\"_zl_timestamp\":1621246428716,\"LogLevel\":\"WARN\",\"Message\":\"Batch of prepared statements\"},{\"_zl_timestamp\":1621246428716,\"LogLevel\":\"WARN\",\"Message\":\"Batch of prepared statements\"}]" https://logc.site24x7.com/event/receiver?token=<TokenValue>
Here, TokenValue will be available at the particular Log type page after enabling API upload. The 'zl_timestamp' field is mandatory in the log lines and it should be in unix timestamp format.
You can verify and confirm that AppLogs has received your test data using the response code 200 OK.
To view the logs, search with the log type in the AppLogs page. It may take a couple of minutes to index the log.
HTTPS file upload
You can also upload your log files using Site24x7's HTTPS endpoint. Site24x7 supports JSON, ZIP, and GZ files.
Testing:
Make sure your logs are sending correctly by running your own application to send logs, or by using the example below.
Example:
Open a command prompt and enter the following cURL command with JSON values.
curl -X POST -H "Content-Type: application/json" --data "@sample.json" https://logc.site24x7.com/event/receiver?token=<TokenValue>
Here, TokenValue will be available at the particular Log type page after enabling API upload. The 'zl_timestamp' field is mandatory in the log lines and it should be in unix timestamp format.
You can verify and confirm that AppLogs has received your test data using the response code 200 OK.
To view the logs, search with the log type in the AppLogs page. It may take a couple of minutes to index the log.
- US - logc.site24x7.com
- EU - logc.site24x7.eu
- IN - logc.site24x7.in
- AU - logc.site24x7.net.au
- CN - logc.site24x7.cn
Uploading files directly from the AppLogs search console
- Log in to Site24x7 and click the AppLogs tab on the left pane.
- Click Upload at the right-most corner of the query field.
- Choose your log type from the drop-down list in the pop-up.
- Browse and upload your files.
Limitations:
- You can send the last 30 days' worth of logs using Site24x7's HTTPS endpoint. Older logs can be uploaded but won't be available for search.
- For a single request, you can only send up to 5MB of logs in bulk.
Other upload options:
You can also upload logs to Site24x7 directly using the AppLogs agent. To do this, you need to install the Server Monitoring agent, define your log type, associate it with a log profile, and start uploading logs.
Troubleshooting steps:
If your logs aren't uploading, it could be due to any of the following reasons:
Error message | Description |
Authentication failed. Invalid device key. | Double-check your device key to make sure it's correct. |
Invalid log type value passed. | This log type does not exist in your account. |
API upload is not enabled for this log type. | You need to enable API Upload for this log type. |
License limit reached. | You need to purchase additional AppLogs add-ons. |
File size exceeded. | The maximum uploadable file size is 5MB. |
File format is not supported. | Only TXT, LOG, ZIP, and GZ file types are supported. |