-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: a brief placeholder document for log-query endpoint #1489
Open
waynexia
wants to merge
3
commits into
main
Choose a base branch
from
log-query
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+108
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
keywords: [log query, logs, search, experimental, HTTP endpoint] | ||
description: Documentation for GreptimeDB's experimental log query endpoint, which provides a dedicated HTTP interface for searching and processing log data. | ||
--- | ||
|
||
# Log Query (Experimental) | ||
|
||
::: warning | ||
The log query endpoint feature is currently experimental and may change in future releases. | ||
::: | ||
|
||
GreptimeDB provides a dedicated HTTP endpoint to query log data. This feature allows you to search and process log entries using a simple query interface. This is an add-on feature to existing GreptimeDB capabilities like SQL queries and Flow computations. You can still use your existing tools and workflows to query log data like before. | ||
|
||
## Endpoint | ||
|
||
```http | ||
POST /v1/logs | ||
``` | ||
|
||
## Headers | ||
- [Authorization](/user-guide/protocols/http.md#authentication) | ||
- `Content-Type`: `application/json` | ||
|
||
## Request Format | ||
|
||
The request body should be a JSON object (this is subject to change in patch version within the experimental phase). For the latest request format, please refer to the [implementation](https://github.com/GreptimeTeam/greptimedb/blob/main/src/log-query/src/log_query.rs): | ||
|
||
## Response | ||
|
||
This endpoint has the same response format as the SQL query endpoint. Please refer to the [SQL query response](/user-guide/protocols/http/#response) for more details. | ||
|
||
## Limitations | ||
|
||
- Maximum result limit: 1000 entries | ||
- Only supports tables with timestamp and string columns | ||
waynexia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Example | ||
|
||
The following example demonstrates how to query log data using the log query endpoint. | ||
|
||
```shell | ||
curl -X "POST" "http://localhost:4000/v1/logs" \ | ||
-H "Content-Type: application/json" \ | ||
-d $' | ||
{ | ||
"table": { | ||
"catalog_name": "greptime", | ||
"schema_name": "public", | ||
"table_name": "my_logs" | ||
}, | ||
"time_filter": { | ||
"start": "2025-01-23" | ||
}, | ||
"limit": { | ||
"fetch": 1 | ||
}, | ||
"columns": [ | ||
"message" | ||
], | ||
"filters": [ | ||
{ | ||
"column_name": "message", | ||
"filters": [ | ||
{ | ||
"Contains": "production" | ||
} | ||
] | ||
} | ||
], | ||
"context": "None", | ||
"exprs": [] | ||
} | ||
' | ||
``` | ||
|
||
In this query, we are searching for log entries in the `greptime.public.my_logs` table that contain the word `production` in `message` field. We also specify the time filter to fetch logs in `2025-01-23`, and limit the result to 1 entry. | ||
|
||
The response will be similar to the following: | ||
|
||
```json | ||
{ | ||
"output": [ | ||
{ | ||
"records": { | ||
"schema": { | ||
"column_schemas": [ | ||
{ | ||
"name": "message", | ||
"data_type": "String" | ||
} | ||
] | ||
}, | ||
"rows": [ | ||
[ | ||
"Everything is in production" | ||
] | ||
], | ||
"total_rows": 1 | ||
} | ||
} | ||
], | ||
"execution_time_ms": 30 | ||
} | ||
``` |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please explain all the keys of the JSON object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are likely to be changed. This document is only a placeholder for the new experimental endpoint. I'll fill details when it turns stable