Skip to main content

Module query

Module query 

Source
Expand description

§Log Querying

This module provides structures and functions for querying processed log data. Log data is structured into LogGroups, which are collections of similar log records. The primary structure for querying this data is the query::LogStore.

The LogStore is generic and operates on data provided by a drains::api::Drain implementation. This means it doesn’t own the log data directly but rather queries it from the underlying drain.

Key functionalities include:

  • Retrieving LogGroups by their unique ID via the LogStore.
  • Filtering LogGroups based on a specific time range using the LogStore.
  • Executing LogQL queries against the LogStore using query::execute_logql_query.
  • Performing range-based aggregation on records (from specific log groups or LogQL queries) within a given time window, facilitated by query::query_log_range_aggregation.

§Log Querying System

This module provides structures and functions for querying log data. The central component is the [LogStore], which acts as an abstraction layer over a log data source, represented by an implementation of the Drain trait.

It also defines LogQL (Log Query Language) related structures like [LogQlQuery], [StreamSelector], and [LineFilter] to enable structured querying of logs.

Structs§

LineFilter
Represents a line filter for LogQL queries.
LogQlQuery
Represents a LogQL query, combining a stream selector and an optional line filter.
LogStore
A generic log data store that interacts with a log source via the Drain trait.

Enums§

QuerySource
Specifies the source of records for a query, either by a direct ID or a LogQL query.
StreamSelector
Represents a selector for log streams in LogQL queries.

Functions§

execute_logql_query
Executes a LogQL query against the provided LogStore.
query_log_range_aggregation
Aggregates log records based on a query source and a time range.