Skip to main content

Tiny library to push logs to `Grafana Loki` in `logfmt` format.

Project description

smoloki

PyPI version

Tiny library to push logs to Grafana Loki in logfmt format.

import smoloki


async def as_request_completed():
    await smoloki.push(
        {'service': 'web'},
        {'level': 'info', 'event': 'request_completed'},
    )


def as_request_completed():
    smoloki.push_sync(
        {'service': 'web'},
        {'level': 'info', 'event': 'request_completed'},
    )

CLI

usage: smoloki [-h] [-b BASE_ENDPOINT] labels information

cli for pushing to loki

positional arguments:
  labels            json-encoded string with labels
  information       json-encoded string with information

options:
  -h, --help        show this help message and exit
  -b BASE_ENDPOINT  base address of loki server

Implementation details

  • Calls to push method will never throw. Any exception will just be logged using logging.
  • Keys in labels and information must be strings.
  • Values in labels and information must be string, integers or floats.
  • If no base_endpoint provided (using parameter or env), nothing will happen.

Configuration

  • SMOLOKI_BASE_ENDPOINT – base address of loki server.
  • SMOLOKI_BASE_LABELS - base labels that will be added to logs.
  • SMOLOKI_BASE_INFORMATION - base information that will be added to logs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smoloki-0.0.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distributions

smoloki-0.0.5-py3.10.egg (6.9 kB view details)

Uploaded Source

smoloki-0.0.5-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file smoloki-0.0.5.tar.gz.

File metadata

  • Download URL: smoloki-0.0.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for smoloki-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7ef3f45a9e097d54144a223a37cbf20d9bb5cd43a68ac908cf34049d8b2a038b
MD5 6b56d39df970aa6c9e5ac973c2e17e74
BLAKE2b-256 2c842500e6761540d6bd4408fb653f8decb21d5b8fbaf4416ab51a76d8a4b8a4

See more details on using hashes here.

File details

Details for the file smoloki-0.0.5-py3.10.egg.

File metadata

  • Download URL: smoloki-0.0.5-py3.10.egg
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for smoloki-0.0.5-py3.10.egg
Algorithm Hash digest
SHA256 69926b2e89593d5bc99f18d221483c4c1c6289ba746c0911f24420eb48b43a27
MD5 47833027d5fa3b56e7b975d7b15d86e6
BLAKE2b-256 4b200b46ed837d12c3b906c13372bc12ba3fc89f50f0c7ed995e1ebd90cee676

See more details on using hashes here.

File details

Details for the file smoloki-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: smoloki-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for smoloki-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ac5673f0a0259e0d85a7dc038c6e9dd78739f0e1c5f6c36f26462ed2e74e3aa2
MD5 4333df2860a6df7080111506ca8ee68d
BLAKE2b-256 fa8978fa55a393b8cf2e9376363486c73a73c015efedcdb1009dee014375e5e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page