Skip to content

Commit

Permalink
Add docs for Loki connector
Browse files Browse the repository at this point in the history
  • Loading branch information
mosabua committed Jan 30, 2025
1 parent 4971ef1 commit 72cb492
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/main/sphinx/connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Ignite <connector/ignite>
JMX <connector/jmx>
Kafka <connector/kafka>
Kudu <connector/kudu>
Loki <connector/loki>
MariaDB <connector/mariadb>
Memory <connector/memory>
MongoDB <connector/mongodb>
Expand Down
71 changes: 71 additions & 0 deletions docs/src/main/sphinx/connector/loki.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Loki connector

```{raw} html
<img src="../_static/img/loki.png" class="connector-logo">
```

The Loki connector allows querying log data stored in [Grafana
Loki](https://grafana.com/oss/loki/). This document describes how to configure a
catalog with the Loki connector to run SQL queries against Loki.

## Requirements

To connect to Loki, you need:

- Loki 3.1.0 or higher.
- Network access from the Trino coordinator and workers to Loki.
Port 3100 is the default port.

## Configuration

The connector can query log data in Loki. Create a catalog properties file that
specifies the Loki connector by setting the `connector.name` to `loki`.

For example, to access a database as the `example` catalog, create the file
`etc/catalog/example.properties`.

```text
connector.name=loki
loki.uri=http://loki.example.com:3100
```

The `loki.uri` property specifies the URI endpoint for the Loki server that
Trino cluster nodes use to access the Loki APIs.

The optional property `loki.query-timeout` defaults to `10s` and controls the
[duration]() Trino waits for a result from Loki before the specific query
request times out. A minimum of `1s` is required.

(loki-type-mapping)=
## Type mapping

Because Trino and Loki each support types that the other does not, this
connector [modifies some types](type-mapping-overview) when reading data.

### Loki type to Trino type mapping

The connector maps Loki types to the corresponding Trino types following
this table:

:::{list-table} Loki type to Trino type mapping
:widths: 40, 60
:header-rows: 1

* - Loki type
- Trino type
* - `tbd`
- `tbd`
:::

No other types are supported.

(loki-sql-support)=
## SQL support

The connector provides read access to data and metadata in Loki. In addition to
the [globally available](sql-globally-available) and [read
operation](sql-read-operations) statements, the connector supports the following
features:

(loki-query-function)=
#### `query_range(varchar) -> table`
Binary file added docs/src/main/sphinx/static/img/loki.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72cb492

Please sign in to comment.