-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 4 | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Endpoints | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# Querying | ||
|
||
To run adhoc queries for exploratory analysis, use the Querying or Search functionality. The use case for this differs from other features that Logflare offers: | ||
|
||
- For periodic query-based checks and data push integrations, use the Alerting functionality. | ||
- For building GET APIs for downstream programmatic consumption and data pull integrations, use the Endpoints functionality | ||
|
||
## Via Management API | ||
|
||
Sources can be queried through SQL using our management API. | ||
|
||
The following query parameters are available: | ||
|
||
- `?sql=` (string): accepts a BQ SQL query, alias for `?bq_sql=`. | ||
- `?bq_sql=` (string): accepts a BigQuery SQL query. | ||
- `?pg_sql=` (string): accepts a Postgres SQL query, for running on PostgreSQL backends. The first PostgreSQL backend will be selected. | ||
|
||
``` | ||
# Endpoint | ||
GET https://api.logflare.app/api/query?sql=... | ||
# With a query | ||
GET https://api.logflare.app/api/query?bq_sql=select id, event_message, datetime(timestamp) as timestamp from `my_source` where timestamp > '2024-01-01' | ||
``` | ||
|
||
## Caveats and Limitations | ||
|
||
The following caveats apply when querying this management API route: | ||
|
||
- Due to the partitioning that Logflare performs, queries must have a `WHERE` filter over the `timestamp` field at all times. | ||
- A hard maximum of 1000 rows will be returned for the BigQuery backend. |