You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crowdsec-docs/docs/log_processor/data_sources/http.md
+39-11Lines changed: 39 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,29 +63,61 @@ labels:
63
63
type: mytype
64
64
```
65
65
66
-
:::info
67
-
If most of cases when the logs are sent in JSON format, you can use the [`transform`](https://docs.crowdsec.net/docs/next/data_sources/intro/#transform) expression to parse the logs.
68
-
:::
66
+
Look at the `Parameters` section to view all supported options.
67
+
68
+
## Body format
69
+
70
+
The datasource expect to receive one or multiple JSON objects.
71
+
72
+
The datasource will also automatically decompress any request body in `gzip` format, as long as the `Content-Encoding` header is set to `gzip`.
73
+
74
+
The JSON object can be any format, crowdsec will pass it as-is to the parsers.
75
+
76
+
If you are sending multiple JSON object in the same request, they must be separated by a newline (NDJSON format):
77
+
```json
78
+
{"log": "log line 1", "timestamp": "2021-01-01T00:00:00Z"}
79
+
{"log": "log line 2", "timestamp": "2021-01-01T00:00:01Z"}
80
+
```
81
+
82
+
The objects will be processed by the parsers one-by-one.
83
+
84
+
If you send multiple log lines in a single JSON object, you can use a [transform](/docs/log_processor/data_sources/introduction.md#transform) expression to generate multiple events:
69
85
70
-
For example, if the logs are sent in the following format:
71
86
```json
72
87
{
73
88
"Records": [
74
89
{
75
90
"message": "test",
76
91
"timestamp": "2021-01-01T00:00:00Z"
92
+
},
93
+
{
94
+
"message": "test2",
95
+
"timestamp": "2021-01-01T00:00:01Z"
77
96
}
78
97
]
79
98
}
80
99
```
81
100
82
-
the `transform` expression can be:
101
+
Using the following `transform` expression will make the datasource generate one event per entry in the array:
0 commit comments