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.

basic

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:

1
https://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:

1
curl -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
basic

Send data to your log

You will see this output in your terminal window

1
HTTP/1.1 204 No Content
2
Cache-Control: no-cache, no-store, must-revalidate
3
Content-Length: 0
4
Date: Fri, 23 Feb 2018 12:08:53 GMT
5
Expires: 0
6
Pragma: no-cache
7
Connection: keep-alive

Using Python:

1
import requests
2
data = { "msg": "My Log Message"}
3
req = 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:

1
function sendLogData(logMessage)
2
{
3
// strip line feeds or they'll appear as individual entries
4
logMessage = logMessage.replace(/\n/g, "");
5
6
var OpsWebhookURL = "https://us.webhook.logs.insight.rapid7.com/v1/noformat/abc123-abc2-xyz1-abc-1234567890";
7
8
$.ajax({
9
type: "POST",
10
url: OpsWebhookURL,
11
data: logMessage,
12
dataType: "text/json",
13
processData: false
14
});
15
}
16
17
//send some data
18
sendLogData('This is an unformatted log entry');
19
sendLogData('{"message" : "this is a JSON Message"}');