Support API HTTP/S event endpoint

HTTP/S Event Endpoint

You can POST a single or multiline event to Loggly using our HTTP/S endpoint which is also part of our RESTful API. You can send plaintext, any type of automatically parsed log including JSON, and multiline events such as stacktraces. For larger batch data transfers, use our bulk endpoint for faster transmission. If you can only do GET requests, then use our Tracking Pixel.

Basic

1. Setup our HTTP/S Endpoint

You can configure your application to POST data directly to Loggly at this URL. This is not a web page so don’t open it in your browser. If you prefer, we have a variety of libraries available for common programming languages or you can use the curl test below.

http://logs-01.loggly.com/inputs/TOKEN/tag/http/

Replace:

  • TOKEN: enter your customer token from the source setup page
  • Test Sending Data

2. Test Sending Data

You can test by running your own application to send events, or use our examples below.

Plaintext
Copy this to a terminal window, insert your customer token, then run it to log “Hello”.

curl -H "content-type:text/plain" -d 'Hello' http://logs-01.loggly.com/inputs/TOKEN/tag/http/

JSON

curl -H "content-type:application/x-www-form-urlencoded" -d "{\"message\":\"hello world\", \"from\":\"hoover\"}" http://logs-01.loggly.com/inputs/TOKEN/tag/http/

Multiline

Commonly, people prefer to see a multiline stacktrace as a single event within Loggly. This example assumes you’re using the bash shell.

curl -H "content-type:text/plain" -d $'Hello\nWorld' http://logs-01.loggly.com/inputs/TOKEN/tag/http-input/

 

3. Verify

After sending the event, you should see the response ok which indicates we received it.

{"response" : "ok"}

Verify you can find the logs by searching with the http tag over the last 20 minutes. It may take a few minutes to index the event. If it doesn’t work, see the troubleshooting section below.

tag:http

HTTP/S Event Endpoint ExampleAdvanced Options

  • HTTP/S Bulk Endpoint – you can send up to 5MB of logs in bulk which is faster for larger data batches
  • Tracking Pixel – if you can only make GET requests use our tracking pixel
  • Webhook Events – send webhook events from other services into Loggly using this endpoint
  • Loggly Libraries Catalog – we have a variety of libraries available for common languages that implement the HTTP/S interface
  • Automated Parsing – we automatically parse many types of logs including JSON and timestamps
  • Tags – our examples use the http tag but you can include your own tags
  • Event Size – The maximum allowed event size is 1MB.
  • Encrypt Data – Just switch the URL to https to encrypt the data. The SSL handshake may increase latency. It will also use port 443 instead of port 80.
  • Encoding – By default Loggly assumes the content type ‘application/x-www-form-urlencoded’ if you do not specify it in the header. You can set encoding in your header to ‘text/plain’ to leave your data alone and store it as regular text.
  • Search or post your own question in the community forum.

Troubleshooting

  • In Windows server 2012/16, you may observe that when running the command to send multiline logs to Loggly, you will see the {“response: ok”} on terminal but your logs will not reach Loggly. The reason is that the normal Windows command prompt does not resolve the $ character before the actual message. So you have to use a bash prompt like git bash which deals with the $ character and will successfully send your multiline logs to Loggly from windows server environment.
  • Troubleshooting HTTP offers tips if you don’t see data in the verification steps.
Thanks for the feedback! We'll use it to improve our support documentation.