Skip to content

Commit 3d97f77

Browse files
committed
update doc
1 parent d0a8cc7 commit 3d97f77

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

  • crowdsec-docs
    • docs/data_sources
    • versioned_docs/version-v1.6.0/data_sources

crowdsec-docs/docs/data_sources/http.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,27 @@ labels:
6363
type: mytype
6464
```
6565
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+
69+
For example, if the logs are sent in the following format:
70+
```json
71+
{
72+
"Records": [
73+
{
74+
"message": "test",
75+
"timestamp": "2021-01-01T00:00:00Z"
76+
}
77+
]
78+
}
79+
```
80+
81+
the `transform` expression can be:
82+
```yaml
83+
transform: map(JsonExtractSlice(evt.Line.Raw, "Records"), ToJsonString(#))
84+
```
85+
86+
6687
Look at the `configuration parameters` to view all supported options.
6788

6889
## Parameters

crowdsec-docs/versioned_docs/version-v1.6.0/data_sources/http.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,27 @@ labels:
6363
type: mytype
6464
```
6565
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+
69+
For example, if the logs are sent in the following format:
70+
```json
71+
{
72+
"Records": [
73+
{
74+
"message": "test",
75+
"timestamp": "2021-01-01T00:00:00Z"
76+
}
77+
]
78+
}
79+
```
80+
81+
the `transform` expression can be:
82+
```yaml
83+
transform: map(JsonExtractSlice(evt.Line.Raw, "Records"), ToJsonString(#))
84+
```
85+
86+
6687
Look at the `configuration parameters` to view all supported options.
6788

6889
## Parameters

0 commit comments

Comments
 (0)