diff --git a/docs/src/main/sphinx/connector.md b/docs/src/main/sphinx/connector.md index 05d7179d6a99..d6003756affc 100644 --- a/docs/src/main/sphinx/connector.md +++ b/docs/src/main/sphinx/connector.md @@ -25,6 +25,7 @@ Ignite JMX Kafka Kudu +Loki MariaDB Memory MongoDB diff --git a/docs/src/main/sphinx/connector/loki.md b/docs/src/main/sphinx/connector/loki.md new file mode 100644 index 000000000000..5d2c45a91a4b --- /dev/null +++ b/docs/src/main/sphinx/connector/loki.md @@ -0,0 +1,71 @@ +# Loki connector + +```{raw} html + +``` + +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` diff --git a/docs/src/main/sphinx/static/img/loki.png b/docs/src/main/sphinx/static/img/loki.png new file mode 100644 index 000000000000..37692fd1093e Binary files /dev/null and b/docs/src/main/sphinx/static/img/loki.png differ