Skip to main content

logql-to-logsql

A Python library that converts Loki's LogQL to VictoriaLogs's LogsQL.

Overview

This library is based on the official VictoriaLogs documentation for converting Loki queries to VictoriaLogs queries. It was inspired by the example Go implementation provided by the VictoriaMetrics team. It supports a subset of the LogsQL language.

Installation

pip install logql-to-logsql

Usage

from logql_to_logsql.translate import TranslateError, TranslateResult, translate_logql_to_logsql


def main():
    try:
        result: TranslateResult = translate_logql_to_logsql('{app="nginx"} |= "error"')
        print(result.logsql)  # {app="nginx"} "error"
        print(result.kind)    # logs
    except TranslateError as e:
        print(f"translation failed: {e}")


if __name__ == '__main__':
    main()

Supported Features

Query Types

  • Log queries
  • Stats queries

Pipeline Stages

  • |=, !=, |~, !~
  • | json, | logfmt, | regexp, | pattern
  • | drop, | keep
  • | line_format, | label_format

Metric Functions

  • rate, count_over_time
  • sum, topk, bottomk
  • avg_over_time, min_over_time, max_over_time
  • quantile_over_time

Metadata

Release files for logql-to-logsql 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for logql-to-logsql 0.2.1
File Actions
logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_x86_64.whl
logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details for logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_aarch64.whl
logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 12.0+ x86-64 Details for logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_x86_64.whl
logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_arm64.whl CPython 3.13 CPython 3.13 macOS 12.0+ ARM64 Details for logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_arm64.whl

Total release size: 52.6 MB

Release files / logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_x86_64.whl

Download URL logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_x86_64.whl
Size 17.6 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a9db00ef21a57e009a65bc1cb1603560c9c032e11b48535e15306afde0869f78
BLAKE2b-256 checksum
How to use checksums
3268117f66e018714dee30ff6dec3b17bfb1a3d58d947741cd09de4e23bb98c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_aarch64.whl

Download URL logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_aarch64.whl
Size 16.1 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
679dec30e2aca7e8f02f2243d38c8e05009ed054fd79180346b51884354b3cf5
BLAKE2b-256 checksum
How to use checksums
03b5aaeb2004486d83cf073cbd666f42e3326d74585ae15e3bd4db71549f3bb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_x86_64.whl

Download URL logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_x86_64.whl
Size 9.8 MB
Tags CPython 3.13 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
7598cc8cf7113d0e619caa76ba096f97366cdbd2755bc44bd5fbc291b7840367
BLAKE2b-256 checksum
How to use checksums
d1deed5ca52e3a515f9e1247ea6031c1e87f4c140f25485acfc8564543403275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_arm64.whl

Download URL logql_to_logsql-0.2.1-cp313-cp313-macosx_12_0_arm64.whl
Size 9.1 MB
Tags CPython 3.13 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
24eaa4c76425087c04bdcd46050ab779a076e8512860132ef4312b9f874575e0
BLAKE2b-256 checksum
How to use checksums
f6314788692099ed705d2ae6d146eb43424377fd0e0d292d31e15bcf9426beb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for logql-to-logsql 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for logql_to_logsql-0.2.1-cp313-cp313-manylinux_2_17_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page