HTTP POST
HTTP POST is a simple way to forward your log messages to InsightOps.
This may be more preferable then other input methods in environments where no InsightOps integrations exist. HTTP POST relies on a User supplying a Token in the same way that Token TCP forwarding method does.
Create a log to send your data to
Log in to InsightOps and click the "Add Data" button in the top navigation.
Click the "Webhook" icon
Give your log a name and select an existing Log set or create a new one
This will display a URL that you will use to send your log data to. The last part of the URL is the log token, which identifies the log that the data should be sent to.
If your InsightOps account is in our European data center, then the URL will start with eu.
Sample URL:
1https://us.webhook.logs.insight.rapid7.com/v1/noformat/abc123-abc2-xyz1-abc-1234567890
Now your log is created, you can send data to it. Here is a sample cURL command:
1curl -i -H "Accept: application/json" -X POST -d '{"message":"sending logs to InsightOps", "success":true}' https://us.webhook.logs.insight.rapid7.com/v1/noformat/abc123-abc2-xyz1-abc-1234567890
Send data to your log
You will see this output in your terminal window
1HTTP/1.1 204 No Content2Cache-Control: no-cache, no-store, must-revalidate3Content-Length: 04Date: Fri, 23 Feb 2018 12:08:53 GMT5Expires: 06Pragma: no-cache7Connection: keep-alive
Using Python:
1import requests2data = { "msg": "My Log Message"}3req = request.post("https://us.webhook.logs.insight.rapid7.com/noformat/logs/abc123-abc2-xyz1-abc-1234567890", data=data)
Here is an example of sending data to the Webhook using JQuery:
1function sendLogData(logMessage)2{3// strip line feeds or they'll appear as individual entries4logMessage = logMessage.replace(/\n/g, "");56var OpsWebhookURL = "https://us.webhook.logs.insight.rapid7.com/v1/noformat/abc123-abc2-xyz1-abc-1234567890";78$.ajax({9type: "POST",10url: OpsWebhookURL,11data: logMessage,12dataType: "text/json",13processData: false14});15}1617//send some data18sendLogData('This is an unformatted log entry');19sendLogData('{"message" : "this is a JSON Message"}');