Skip to content

Commit

Permalink
Move response format schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jeschkies committed Dec 16, 2024
1 parent 782a598 commit f4aaebc
Showing 1 changed file with 40 additions and 29 deletions.
69 changes: 40 additions & 29 deletions docs/sources/reference/loki-http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,26 @@ The items in the `values` array are sorted by timestamp.
The most recent item is first when using `direction=backward`.
The oldest item is first when using `direction=forward`.

Parquet can be request as a response format by setting the `Accept` header to `application/vnd.apache.parquet`.

The schema is the following for streams:

│ column_name │ column_type │
│ varchar │ varchar │
|-------------|--------------------------|
│ timestamp │ TIMESTAMP WITH TIME ZONE │
│ labels │ MAP(VARCHAR, VARCHAR) │
│ line │ VARCHAR │

and for metrics:

│ column_name │ column_type │
│ varchar │ varchar │
|-------------|--------------------------|
│ timestamp │ TIMESTAMP WITH TIME ZONE │
│ labels │ MAP(VARCHAR, VARCHAR) │
│ value │ DOUBLE │

See [statistics](#statistics) for information about the statistics returned by Loki.

### Examples
Expand Down Expand Up @@ -438,35 +458,6 @@ curl -u "User:$API_TOKEN" \
--data-urlencode 'query=sum(rate({job="varlogs"}[10m])) by (level)' | jq
```

### Response Format

The Parquet can be request as a response format by setting the `Accept` header to `application/vnd.apache.parquet`.

```bash
curl -G -s "http://localhost:3100/loki/api/v1/query" \
-H "Accept: application/vnd.apache.parquet" \
--data-urlencode 'query=sum(rate({job="varlogs"}[10m])) by (level)'
-o result.parquet
```

The Parquet schema is the following for streams:

│ column_name │ column_type │
│ varchar │ varchar │
|-------------|--------------------------|
│ timestamp │ TIMESTAMP WITH TIME ZONE │
│ labels │ MAP(VARCHAR, VARCHAR) │
│ line │ VARCHAR │

and for metrics:

│ column_name │ column_type │
│ varchar │ varchar │
|-------------|--------------------------|
│ timestamp │ TIMESTAMP WITH TIME ZONE │
│ labels │ MAP(VARCHAR, VARCHAR) │
│ value │ DOUBLE │

## Query logs within a range of time

```bash
Expand Down Expand Up @@ -547,6 +538,26 @@ The items in the `values` array are sorted by timestamp.
The most recent item is first when using `direction=backward`.
The oldest item is first when using `direction=forward`.

Parquet can be request as a response format by setting the `Accept` header to `application/vnd.apache.parquet`.

The schema is the following for streams:

│ column_name │ column_type │
│ varchar │ varchar │
|-------------|--------------------------|
│ timestamp │ TIMESTAMP WITH TIME ZONE │
│ labels │ MAP(VARCHAR, VARCHAR) │
│ line │ VARCHAR │

and for metrics:

│ column_name │ column_type │
│ varchar │ varchar │
|-------------|--------------------------|
│ timestamp │ TIMESTAMP WITH TIME ZONE │
│ labels │ MAP(VARCHAR, VARCHAR) │
│ value │ DOUBLE │

See [statistics](#statistics) for information about the statistics returned by Loki.

### Examples
Expand Down

0 comments on commit f4aaebc

Please sign in to comment.