Skip to content

Commit 9b0a9dd

Browse files
authored
added generic http event streaming docs (#365)
* added generic http event streaming docs * minor fix * rename to mdx * minor fix
1 parent be7e209 commit 9b0a9dd

File tree

8 files changed

+101
-2
lines changed

8 files changed

+101
-2
lines changed
-93.3 KB
Loading
201 KB
Loading
130 KB
Loading
146 KB
Loading
118 KB
Loading

src/components/NavigationDocs.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export const docsNavigation = [
174174
{ title: 'Datadog', href: '/how-to/stream-activity-to-datadog' },
175175
{ title: 'Amazon S3', href: '/how-to/stream-activity-to-amazon-s3' },
176176
{ title: 'Amazon Firehose', href: '/how-to/stream-activity-to-amazon-firehose'},
177+
{ title: 'Generic HTTP', href: '/how-to/stream-activity-to-generic-http'},
177178
]
178179
},
179180
],

src/pages/how-to/activity-event-streaming.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ detecting, and responding to security threats in real-time. By aggregating and a
99
SIEMs help identify anomalous patterns and potential breaches, providing a centralized view of security events.
1010

1111
NetBird provides an event streaming feature that allows you to stream network [activity events](/how-to/monitor-system-and-network-activity)
12-
to third-party SIEM systems, such as [Datadog](https://www.datadoghq.com/dg/security/siem-solution/), [Amazon S3](https://aws.amazon.com/s3/), [Amazon Data Firehose](https://aws.amazon.com/firehose/), and others.
12+
to third-party SIEM systems, such as [Datadog](https://www.datadoghq.com/dg/security/siem-solution/), [Amazon S3](https://aws.amazon.com/s3/), [Amazon Data Firehose](https://aws.amazon.com/firehose/), and others through a generic HTTP integration.
1313

1414
<Note>
1515
This feature is only available in the cloud version of NetBird.
@@ -20,4 +20,5 @@ supported third-party platforms. To get started, select one of the following int
2020

2121
- [Datadog](/how-to/stream-activity-to-datadog)
2222
- [Amazon S3](/how-to/stream-activity-to-amazon-s3)
23-
- [Amazon Data Firehose](/how-to/stream-activity-to-amazon-firehose)
23+
- [Amazon Data Firehose](/how-to/stream-activity-to-amazon-firehose)
24+
- [Generic HTTP](/how-to/stream-activity-to-generic-http)
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Stream Network Activity to a Generic HTTP Endpoint
2+
3+
The Generic HTTP integration allows you to stream your NetBird network activity events to any custom HTTP/S endpoint. This provides a flexible way to connect NetBird with a wide range of third-party systems, including custom SIEMs, log management tools like Grafana Loki, or any service that can receive POST requests.
4+
5+
For every event, NetBird will send a POST request to your configured endpoint. You have full control over the request's body format and headers, allowing for seamless integration with various APIs.
6+
7+
<Note>
8+
This feature is only available in the cloud version of NetBird.
9+
</Note>
10+
11+
## Prerequisites
12+
13+
Before you start, ensure you have an HTTP/S endpoint that is publicly accessible and ready to receive POST requests from NetBird. You will also need any necessary authentication details, such as an API key or credentials for Basic Authentication.
14+
15+
## Create an Integration in NetBird
16+
17+
1. Navigate to the **Integrations** tab in the NetBird dashboard and select **Event Streaming**.
18+
2. Find the **Generic HTTP** option and click **Connect**.
19+
3. A configuration panel will open with several tabs: **General**, **Headers**, **Body Template**, and **Danger Zone**.
20+
21+
### General Configuration
22+
23+
This tab is for the essential endpoint details.
24+
25+
<p>
26+
<img src="/docs-static/img/how-to-guides/activity-event-streaming/generic-http/general-config.png" alt="Generic HTTP General Configuration" className="imagewrapper-big"/>
27+
</p>
28+
29+
- **Endpoint URL**: Enter the full HTTPS or HTTP URL where NetBird should send the events. This field is mandatory.
30+
- **Authentication**: Select the authentication method required by your endpoint.
31+
- **No Authentication**: Sends requests without an `Authorization` header.
32+
- **Bearer Token**: Adds an `Authorization: Bearer <your-token>` header to each request. You will need to provide your API key or token.
33+
- **Basic Auth**: Adds an `Authorization: Basic <credentials>` header. You must provide the credentials in the format `username:password`.
34+
35+
### HTTP Headers (Optional)
36+
37+
You can add custom HTTP headers to every outgoing request in the **Headers** tab. This is useful for passing static tokens, setting a custom `Content-Type`, or other API requirements. By default, the `Content-Type` is `application/json`.
38+
39+
<p>
40+
<img src="/docs-static/img/how-to-guides/activity-event-streaming/generic-http/headers-config.png" alt="Generic HTTP Headers Configuration" className="imagewrapper-big"/>
41+
</p>
42+
43+
### Custom Body Template (Optional)
44+
45+
The **Body Template** tab gives you powerful control over the structure of the JSON payload sent to your endpoint.
46+
47+
<p>
48+
<img src="/docs-static/img/how-to-guides/activity-event-streaming/generic-http/body-template-config.png" alt="Generic HTTP Body Template Configuration" className="imagewrapper-big"/>
49+
</p>
50+
51+
If this option is disabled, NetBird sends a default JSON object for each event. When enabled, you can define your own payload structure using Go's `text/template` templating engine.
52+
53+
This is especially useful for integrating with services that expect a specific format, like Grafana Loki.
54+
55+
#### Available Template Variables
56+
57+
You can use the following variables from the `StreamEvent` object in your template:
58+
59+
| Variable | Type | Description | Example Usage |
60+
|---------------|----------------------|--------------------------------------------------------------------------------------|-----------------------------------|
61+
| `.ID` | `any` | The unique ID of the event. | `{"event_id": "{{.ID}}"}` |
62+
| `.Timestamp` | `time.Time` | The timestamp of when the event occurred. Can be formatted. | `{{.Timestamp.UnixNano}}` / `{{.Timestamp.Format "2006-01-02T15:04:05.999Z07:00"}}` |
63+
| `.Message` | `string` | A human-readable message describing the event. | `{"text": "{{.Message}}"}` |
64+
| `.InitiatorID`| `string` | The ID of the object that initiated the event (e.g., a user or peer ID). | `{"user": "{{.InitiatorID}}"}` |
65+
| `.TargetID` | `string` | The ID of the object that was affected by the event (e.g., a peer or group ID). | `{"resource": "{{.TargetID}}"}` |
66+
| `.Meta` | `map[string]any` | A map containing additional metadata about the event. | `{"source": "{{.Meta.source}}"}` |
67+
| `.Reference` | `string` | A URL to the event in the NetBird activity log for easy cross-referencing. | `{"ref": "{{.Reference}}"}` |
68+
69+
### Danger Zone
70+
71+
This tab allows you to delete the integration. This action is irreversible and will immediately stop events from being sent to your endpoint.
72+
73+
<p>
74+
<img src="/docs-static/img/how-to-guides/activity-event-streaming/generic-http/danger-zone.png" alt="Generic HTTP Danger Zone" className="imagewrapper-big"/>
75+
</p>
76+
77+
After configuring all settings, click **Save Changes**.
78+
79+
## Verify the Integration
80+
81+
Once you save the integration, NetBird sends a test event to your endpoint to confirm that the connection and authentication are successful.
82+
83+
Check the logs of your receiving service for a new POST request. You should find a JSON payload similar to this (if custom template wasn't set up):
84+
85+
```json
86+
{
87+
"ID": "test-event-1685635200",
88+
"Timestamp": "2025-06-01T16:00:00Z",
89+
"Message": "integration test event for generic http endpoint",
90+
"InitiatorID": "netbird-test-system",
91+
"TargetID": "target-id",
92+
"Meta": {
93+
"purpose": "configuration-test",
94+
"source": "netbird-test"
95+
},
96+
"Reference": "netbird:test:generichttp"
97+
}

0 commit comments

Comments
 (0)