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.6.tar.gz (3.6 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: smoloki-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 0fa254943d97527f0598789744c5a16562d94fba8f75b0da6e871f35b404275c
MD5 9126365e10b451d03f51bea678cf0919
BLAKE2b-256 22ea275d2d1793a9b7b32214da7c4c23d08b003066973242910f71fd1f7171f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smoloki-0.0.6-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.6-py3.10.egg
Algorithm Hash digest
SHA256 eb005d7df224ab86182586f81a3f538843a171cf4f90e8bd0ee82cdcd6c5948e
MD5 2d7021986c7142ee1ab0063b20ef11c1
BLAKE2b-256 9402a959d3d6a27fc8b570d72f1db9de84f117a9e7c3ade05eb336d7547ab1c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smoloki-0.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 03cf3bc99d1052e1d1756107aae09599e8ab778525e1fd9b547dcbeb05159928
MD5 b226adb1c081fd07a78ce0c8a1aa5fa0
BLAKE2b-256 a14b2850c199ecf09b44b9ea1f42f1f81f3e78e950c6907ec32d3310a946d8c0

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