Skip to content

Commit 3384941

Browse files
committed
modified example queries file
1 parent 11edcf6 commit 3384941

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

docs/example-queries.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,8 @@ code >= 400
6767

6868
![Invalid Syntax](../images/example-queries/equalto-greaterthan-error.png)
6969

70-
## Aggregations & Complex Queries
71-
72-
**Histogram of log timestamps with status code counts:**
73-
```sql
74-
SELECT
75-
histogram(_timestamp) AS ts_histogram,
76-
count(CASE WHEN code = 200 THEN 1 END) AS code_200_count,
77-
count(CASE WHEN code = 401 THEN 1 END) AS code_401_count,
78-
count(CASE WHEN code = 500 THEN 1 END) AS code_500_count
79-
FROM your_stream_name
80-
GROUP BY ts_histogram
81-
```
82-
83-
Replace `your_stream_name` with the actual stream name in your OpenObserve setup.
84-
- `histogram(_timestamp)` bins timestamps into uniform intervals (e.g. hourly). You can configure the granularity in the UI or query if needed.
85-
![Histogram of log timestamps](../images/example-queries/histogram.png)
86-
8770

88-
## Filtering Queries
71+
## Filtering using WHERE Clause
8972

9073
**Filter by service and status code:**
9174
```sql
@@ -129,3 +112,19 @@ LIMIT 10
129112

130113

131114

115+
## Aggregations & Complex Queries
116+
117+
**Histogram of log timestamps with status code counts:**
118+
```sql
119+
SELECT
120+
histogram(_timestamp) AS ts_histogram,
121+
count(CASE WHEN code = 200 THEN 1 END) AS code_200_count,
122+
count(CASE WHEN code = 401 THEN 1 END) AS code_401_count,
123+
count(CASE WHEN code = 500 THEN 1 END) AS code_500_count
124+
FROM your_stream_name
125+
GROUP BY ts_histogram
126+
```
127+
128+
Replace `your_stream_name` with the actual stream name in your OpenObserve setup.
129+
- `histogram(_timestamp)` bins timestamps into uniform intervals (e.g. hourly). You can configure the granularity in the UI or query if needed.
130+
![Histogram of log timestamps](../images/example-queries/histogram.png)

0 commit comments

Comments
 (0)