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: docs/sql_reference.md
+87-17Lines changed: 87 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: >-
5
5
---
6
6
This guide describes the custom SQL functions supported in OpenObserve for querying and processing logs and time series data. These functions extend the capabilities of standard SQL by enabling full-text search, array processing, and time-based aggregations.
7
7
8
-
## Full-text Search Functions
8
+
## Full-text search functions
9
9
These functions allow you to filter records based on keyword or pattern matches within one or more fields.
10
10
11
11
### `str_match(field, 'value')`
@@ -26,6 +26,31 @@ This query filters logs from the `default` stream where the `k8s_pod_name` field
The `match_all` function also supports the following patterns for flexible searching:
95
+
96
+
-**Prefix search**: Matches keywords that start with the specified prefix:
97
+
```sql
98
+
SELECT*FROM"default"WHERE match_all('ab*')
99
+
```
100
+
-**Postfix search**: Matches keywords that end with the specified suffix:
101
+
```sql
102
+
SELECT*FROM"default"WHERE match_all('*ab')
103
+
```
104
+
-**Contains search**: Matches keywords that contain the substring anywhere:
105
+
```sql
106
+
SELECT*FROM"default"WHERE match_all('*ab*')
107
+
```
108
+
-**Phrase prefix search**: Matches keywords where the last term uses prefix matching:
109
+
```sql
110
+
SELECT*FROM"default"WHERE match_all('key1 key2*')
111
+
```
112
+
### `not match_all('value')`
113
+
**Description**: <br>
114
+
115
+
- Filters logs by excluding records where the keyword appears in any field that has the Index Type set to Full Text Search in the stream settings.
116
+
- This function is case-insensitive and excludes matches regardless of the keyword's casing.
117
+
-**Important**: Only searches fields configured as Full Text Search fields. Other fields in the record are not evaluated.
118
+
- Provides significant performance improvements when used with indexed fields.
119
+
120
+
**Example**:
121
+
```sql
122
+
SELECT*FROM"default"WHERE NOT match_all('foo')
123
+
```
124
+
This query returns all logs in the `default` stream where the keyword `foo` does NOT appear in any of the full-text indexed fields. Fields not configured for full-text search are ignored.
125
+
126
+
**Combining NOT match_all with NOT str_match**:
127
+
```sql
128
+
SELECT*FROM"default"WHERE (NOT str_match(f1, 'bar')) AND (NOT match_all('foo'))
129
+
```
130
+
This query returns logs where field `f1` does NOT contain `bar` AND no full-text indexed field contains `foo`. In other words, it excludes records that match either condition.
131
+
132
+
**Using NOT with OR conditions**:
133
+
```sql
134
+
SELECT*FROM"default"WHERE NOT (str_match(f1, 'bar') OR match_all('foo'))
135
+
```
136
+
This query returns logs where BOTH conditions are false: field `f1` does NOT contain `bar` AND no full-text indexed field contains `foo`. In other words, it excludes records that match either condition.
137
+
68
138
---
69
139
### `re_match(field, 'pattern')`
70
140
**Description**: <br>
@@ -113,7 +183,7 @@ This query returns logs from the `default` stream where the `k8s_container_name`
113
183
114
184
---
115
185
116
-
## Array Functions
186
+
## Array functions
117
187
The array functions operate on fields that contain arrays. In OpenObserve, array fields are typically stored as stringified JSON arrays.
118
188
<br>For example, in a stream named `default`, there may be a field named `emails` that contains the following value:
Aggregate functions compute a single result from a set of input values. For usage of standard SQL aggregate functions such as `COUNT`, `SUM`, `AVG`, `MIN`, and `MAX`, refer to [PostgreSQL documentation](https://www.postgresql.org/docs/).
307
377
308
378
### `histogram(field, 'duration')`
@@ -324,7 +394,7 @@ FROM "default"
324
394
GROUP BY key
325
395
ORDER BY key
326
396
```
327
-
**Expected Output**: <br>
397
+
**Expected output**: <br>
328
398
329
399
This query divides the log data into 30-second intervals.
330
400
Each row in the result shows:
@@ -416,7 +486,7 @@ ORDER BY request_count DESC
416
486
- Each core maintains hash tables during aggregation across all partitions
Resources exhausted: Failed to allocate additional 63232256 bytes for GroupedHashAggregateStream[20] with 0 bytes already allocated for this reservation - 51510301 bytes remain available for the total pool
422
492
```
@@ -434,7 +504,7 @@ ORDER BY request_count DESC
434
504
**Scenario** <br>
435
505
Find the top 10 client IPs by request count from web server logs distributed across 3 follower query nodes.
The approx_topk function returns approximate results because it relies on each query node sending only its local top N entries to the leader. The leader combines these partial lists to produce the final result.
503
573
@@ -599,7 +669,7 @@ ORDER BY distinct_count DESC
599
669
- Memory usage for distinct counting: Potentially unlimited storage for tracking unique values.
600
670
- Combined with grouping: Memory requirements become exponentially larger.
601
671
602
-
**Typical Error Message:**
672
+
**Typical error message:**
603
673
```
604
674
Resources exhausted: Failed to allocate additional 63232256 bytes for GroupedHashAggregateStream[20] with 0 bytes already allocated for this reservation - 51510301 bytes remain available for the total pool
605
675
```
@@ -610,7 +680,7 @@ ORDER BY distinct_count DESC
610
680
SELECT approx_topk_distinct(clientip, clientas, 10) FROM default
611
681
```
612
682
613
-
**Combined Approach:**
683
+
**Combined approach:**
614
684
615
685
- **HyperLogLog**: Handles distinct counting using a fixed **16 kilobytes** data structure per group.
616
686
- **Space-Saving**: Limits the number of groups returned from each partition to top K.
@@ -619,7 +689,7 @@ ORDER BY distinct_count DESC
619
689
**Example: Web Server User Agent Analysis**
620
690
Find the top 10 client IPs by unique user agent count from web server logs in the `default` stream.
621
691
622
-
**Raw Data Distribution**
692
+
**Raw data distribution**
623
693
624
694
| Node 1 | Distinct User Agents | Node 2 | Distinct User Agents | Node 3 | Distinct User Agents |
Copy file name to clipboardExpand all lines: docs/storage-management/storage.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -191,7 +191,11 @@ OpenObserve supports multiple metadata store backends, configurable using the `Z
191
191
- Recommended for production deployments due to reliability and scalability.
192
192
- The default Helm chart (after February 23, 2024) uses [cloudnative-pg](https://cloudnative-pg.io/) to create a postgres cluster (primary + replica) which is used as the meta store. These instances provide high availability and backup support.
193
193
194
-
### etcd (Deprecated)
194
+
### etcd (Removed)
195
+
196
+
!!! warning "Removal notice"
197
+
Etcd support has been removed. Use NATS instead.
198
+
195
199
- Set `ZO_META_STORE=etcd`.
196
200
- While etcd is used as the cluster coordinator, it was also the default metadata store in Helm charts released before 23 February 2024. This configuration is now deprecated. Helm charts released after 23 February 2024 use PostgreSQL as the default metadata store.
OpenObserve exposes Prometheus metrics to monitor aggregation cache performance and memory usage.
153
155
156
+
| Metric | Description |
157
+
|--------|-------------|
158
+
| `zo_query_aggregation_cache_items` | Monitor to understand cache utilization and verify that streaming aggregation is populating the cache as expected |
159
+
| `zo_query_aggregation_cache_bytes` | Monitor memory consumption to ensure the cache stays within acceptable limits and doesn't exhaust system resources |
0 commit comments