Skip to main content

Crate logql

Crate logql 

Source
Expand description

§LogQL Front-End

Lexing (and, in later phases, parsing and SQL transpilation) for Loki’s LogQL query language. LogQL queries start from a stream selector ({service_name="api"}), optionally followed by a pipeline of line filters and parser stages, or wrapped in range/vector aggregations for metric queries.

§Modules

  • token: token type produced by the lexer
  • lexer: hand-rolled tokenizer with line/column error reporting
  • ast: abstract syntax tree for log queries
  • metric: abstract syntax tree for metric queries
  • parser: recursive-descent parser over the token stream

Re-exports§

pub use ast::FilterOp;
pub use ast::FilterValue;
pub use ast::Grouping;
pub use ast::LabelExtraction;
pub use ast::LabelFilterExpr;
pub use ast::LabelFilterPred;
pub use ast::LabelFormat;
pub use ast::LabelFormatValue;
pub use ast::LabelMatcher;
pub use ast::LabelPredicate;
pub use ast::LineFilter;
pub use ast::LineFilterOp;
pub use ast::LogQuery;
pub use ast::LogfmtStage;
pub use ast::MatchOp;
pub use ast::PipelineStage;
pub use ast::StreamSelector;
pub use ast::Unwrap;
pub use lexer::LexError;
pub use lexer::tokenize;
pub use metric::AggregationFunction;
pub use metric::BinOp;
pub use metric::BinaryExpr;
pub use metric::LabelReplace;
pub use metric::MetricQuery;
pub use metric::RangeAggregation;
pub use metric::RangeFunction;
pub use metric::VectorAggregation;
pub use metric::VectorMatch;
pub use parser::Expr;
pub use parser::ParseError;
pub use parser::parse;
pub use parser::parse_query;
pub use parser::parse_selector;
pub use token::SpannedToken;
pub use token::Token;

Modules§

ast
LogQL AST
lexer
LogQL Lexer
metric
LogQL Metric Query AST
parser
LogQL Parser
token
LogQL Tokens