Skip to main content
Sumo Logic

Upload Data to an HTTP Source

After you have added an HTTP Source to a Hosted Collector you can begin uploading data.

Upload via GET Request

To upload with a GET request, append the data payload as a single query parameter to the Source's upload URL. All content after the ? will be considered part of the payload.

Data payload Sumo is #1!
Method GET
URL https://[SumoEndpoint]/receiver/v1/http/[UniqueHTTPCollectorCode]?Sumo+is+%231%21

Upload via POST Request

To upload with a POST request, include the complete data payload as the request body. Any query parameters will be ignored.

Data payload Data line 1
Data line 2
Data line 3
Method POST
URL https://[SumoEndpoint]/receiver/v1/http/[UniqueHTTPCollectorCode]
Body Data line 1
Data line 2
Data line 3

Compressed Data

You can send Sumo Logic plain, uncompressed data (such as plain text) or you can send data that has been compressed by either the "deflate" method, or the "gzip" method. Compressed data may only be sent with the POST method, not GET. 

To send a compressed payload, specify a value of gzip (for gzip-compressed) or deflate (for zlib-compressed) in the Content-Encoding header of your request, and include the compressed data as the request body.

HTTP Access Control (CORS)

Sumo Logic HTTP sources support clients bound by the CORS mechanism.

To ensure the appropriate Access-Control-* response headers are set, make sure the Origin header is populated in the initial OPTIONS probe and all subsequent requests.

Other Supported HTTP Headers

The following parameters can be specified via headers when sending data to an HTTP Source. The settings will apply to all messages in the request. For Source Name, Host, and Category, the header value will override any default setting already specified for the Source and/or Collector.

Setting Header Name Header Value
Compressed data Content-Encoding gzip or deflate
Custom Source Name X-Sumo-Name desired source name
Custom Source Host X-Sumo-Host desired host name
Custom Source Category X-Sumo-Category desired source category

Command Line Examples


POST upload

curl -v -X POST -T [local_file_name][UniqueHTTPCollectorCode]

When using cURL to POST data from a file, make sure to use the -T parameter to specify the file path, not -d.
The -d parameter will cause new lines to be removed from the content, which will interfere with message boundary detection.

POST upload (gzip compressed data) 

curl -v -X POST -H 'Content-Encoding:gzip' -T [local_file_name.gz][UniqueHTTPCollectorCode]

POST upload (custom Source Category)

curl -v -X POST -H 'X-Sumo-Category:myNewCategory' -T [local_file_name][UniqueHTTPCollectorCode]

GET upload

curl -v[UniqueHTTPCollectorCode]?[message_data]

POST upload

Invoke-WebRequest -Method POST -InFile [local_file_name] '[UniqueHTTPCollectorCode]'

POST upload (gzip compressed data) 

Invoke-WebRequest -Method POST -Headers @{'Content-Encoding' = 'gzip'} -InFile [local_file_name.gz] '[UniqueHTTPCollectorCode]'

POST upload (custom Source Category)

Invoke-WebRequest -Method POST -Headers @{'X-Sumo-Category' = 'myCustomCategory'} -InFile [local_file_name] '[UniqueHTTPCollectorCode]'

GET upload

Invoke-WebRequest '[UniqueHTTPCollectorCode]?[message_data]'