@sigyn/logql
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

LogQL

Parse and serialize LogQL query

npm version size ossf scorecard license

🚧 Requirements

🚀 Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn

$ npm i @sigyn/logql
# or
$ yarn add @sigyn/logql

📚 Usage

Build your LogQL

import { LogQL } from "@sigyn/logql";

const logql = new LogQL("foo");
logql.streamSelector.set("env", "prod");
logql.lineEq("bar");
logql.lineNotEq("baz");

// {env=\"prod\"} |= `foo` |= `bar` != `baz`
console.log(logql.toString());

Parse your LogQL

import { LogQL } from "@sigyn/logql";

const logql = new LogQL("{app=\"foo\", env=\"preprod\"} |= `foo` != `bar`");

console.log([...logql.streamSelector.entries()]);
console.log(logql.lineFilters.lineContains());
console.log(logql.lineFilters.lineDoesNotContain());

🌐 API

Individual LogQL parts (used in the parent class). You can also use them individually for separate needs.

{env="staging"} |= "req-xxx" | pattern `ok: <ok>` | ok = "true" | unpack
^^^             ^^^          ^^^                  ^^^           ^
StreamSelector  LineFilters  ParserExpression     LabelFilters  ParserExpression

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @sigyn/logql

Weekly Downloads

102

Version

2.1.0

License

MIT

Unpacked Size

45.6 kB

Total Files

6

Last publish

Collaborators

  • pierred
  • fraxken