Documentation

logql.query_range() function

logql.query_range() is a user-contributed function maintained by the package author.

logql.query_range() queries data from a specified LogQL query within given time bounds, filters data by query, timerange, and optional limit expressions. All values are returned as string values (using raw mode in csv.from)

Function type signature
(
    query: string,
    ?end: A,
    ?limit: B,
    ?orgid: string,
    ?path: string,
    ?start: C,
    ?step: D,
    ?url: string,
) => stream[E] where A: Timeable, B: Stringable, C: Timeable, D: Stringable, E: Record

For more information, see Function type signatures.

Parameters

url

LogQL/qryn URL and port. Default is http://qryn:3100.

path

LogQL query_range API path.

limit

Query limit. Default is 100.

query

(Required) LogQL query to execute.

start

Earliest time to include in results. Default is -1h.

Results include points that match the specified start time. Use a relative duration or absolute time. For example, -1h or 2022-01-01T22:00:00.801064Z.

end

Latest time to include in results. Default is now().

Results exclude points that match the specified stop time. Use a relative duration or absolute time. For example, -1h or 2022-01-01T22:00:00.801064Z.

step

Query resolution step width in seconds. Default is 10.

Only applies to query types which produce a matrix response.

orgid

Optional Loki organization ID for partitioning. Default is "".

Examples

Query specific fields in a measurement from LogQL/qryn

import "contrib/qxip/logql"

option logql.defaultURL = "http://qryn:3100"

logql.query_range(query: "{job=\"dummy-server\"}", start: -1h, end: now(), limit: 100)

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered