Skip to content

Commit

Permalink
docs: api for querying logflare
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziinc committed Apr 26, 2024
1 parent 43f8d66 commit d681eff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docs.logflare.com/docs/concepts/endpoints.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
---

# Endpoints
Expand Down
35 changes: 35 additions & 0 deletions docs/docs.logflare.com/docs/concepts/querying.md
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.

0 comments on commit d681eff

Please sign in to comment.