Help HTTPS Endpoint API: Sending Logs

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 endpoint setup 

Enter https://logc.site24x7.com/upload into your preferred API development tool. 

  • The headers X-StreamMode:1, X-DeviceKey: DeviceKey, and X-LogType: LogType are mandatory for sending logs via HTTPS endpoint; however, X-StreamMode:1 is not required for uploading the files via HTTPS endpoint. 
  • The date field is not mandatory for sending single-line logs; it is, however, mandatory for multi-line logs and file upload.

HTTPS single-line

You can send single-line logs to Site24x7's HTTPS endpoint in the form of plain text.

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 as plain text.

curl -X POST -H "Content-Type: text/plain" -H "X-StreamMode: 1" -H "X-DeviceKey: DeviceKey" -H "X-LogType: LogType" -d "Happy Logging" https://logc.site24x7.com/upload

In this command, enter your Device Key in place of DeviceKey and replace LogType with your log type.

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 the form of plain text. 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 as plain text.

curl -X POST -H "Content-Type: text/plain" -H "X-StreamMode: 1" -H "X-DeviceKey: DeviceKey" -H "X-LogType: LogType" -d "2018-08-28 02:14:23 Happy Logging\n2018-08-28 02:15:25 Happy Logging" https://logc.site24x7.com/upload

In this command, enter your Device Key in place of DeviceKey and replace LogType with your log type.

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 TXT, LOG, 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 as plain text.

curl -X POST -H "X-DeviceKey: DeviceKey" -H "X-LogType: LogType" -F upload=@sample.log https://logc.site24x7.com/upload

In this command, enter your Device Key in place of DeviceKey and replace LogType with your log type.

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.

Uploading files directly from the AppLogs search console

  1. Log in to Site24x7 and click the AppLogs tab on the left pane.
  2. Click Upload at the right-most corner of the query field.
  3. Choose your log type from the drop-down list in the pop-up.
  4. Browse and upload your files.

    Upload files from console

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.

Related articles:

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help HTTPS Endpoint API: Sending Logs