Skip to content

Commit 83a77ea

Browse files
Merge pull request #31 from IcarusSosie/document-flatten-level-in-json-logs-ingestion-page
Make JSON flattening more explicit
2 parents c5c024f + 3d52935 commit 83a77ea

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/api/ingestion/logs/json.md

+42
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,48 @@ Please note only records having 200 or less fields/columns will be considered fo
9393
9494
One can configure ZO_COLS_PER_RECORD_LIMIT to set desired value for allowed number of fields/columns per record.
9595

96+
## Flattening of the JSON structure
97+
98+
OpenObserve flattens deep JSON logs. Below is an example log before and after being flattened.
99+
100+
#### Before
101+
102+
```json
103+
{
104+
"actor": {
105+
"ip": "[redacted]",
106+
"id": 558875,
107+
"parent" : {
108+
"id": 45516,
109+
"active": true
110+
}
111+
}
112+
"response": {
113+
"error_occured": false,
114+
"status_code": 200
115+
}
116+
117+
}
118+
```
119+
120+
#### After
121+
122+
```json
123+
{
124+
"actor_ip": "[redacted]",
125+
"actor_id": 558875,
126+
"actor_parent_id": 45516,
127+
"actor_parent_active": true,
128+
"response_error_occured": false,
129+
"response_status_code": 200
130+
}
131+
```
132+
133+
### Restriction on flattening depth
134+
135+
⚠️ For performance reasons, OpenObserve limits the depth at which the JSON structure gets flattened. Past that limit, the generated field will contain unparsed JSON as a string.
136+
The default depth is `3`, but this limit can be configured via the `ZO_INGEST_FLATTEN_LEVEL` environment variable. `ZO_INGEST_FLATTEN_LEVEL` can either be `0`, which disables the flattening limit, or any positive number, to change the depth at which the flattening stops.
137+
96138
## Timestamp
97139

98140
By default we add a field `_timestamp` for each record with the value of `NOW` in microseconds (unix epoch value).

0 commit comments

Comments
 (0)