python-logging-loki
Python logging handler for Grafana Loki.
Decision gist · record as of 2026-08-14
Yes, if you run Grafana Loki and need to ship Python logs to it. The package is straightforward, has low dependencies, and carries no known vulnerabilities. However, maintenance is dormant since 2019-11-28, so compatibility with recent Loki API changes or Python versions beyond 3.8 is unverified. For active projects, confirm the handler works with your Loki version before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a reachable Loki instance endpoint and network connectivity to push logs.
- Low install friction with only 2 runtime dependencies (rfc3339, requests).
- Maintenance is dormant—last release was 2019-11-28 and last commit 2024-05-14—but the repository remains unarchived with 171 stars.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
last release 2019-11-28 (2451 days) · last repo commit 2024-05-14 · 171 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,067,188 downloads/mo, #4,410 on PyPI
Alternatives
Verify before relying
pip install python-logging-loki
import logging
import python_logging_loki
handler = python_logging_loki.LokiHandler(
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
version="1"
)
logger = logging.getLogger("my-logger")
logger.addHandler(handler)
logger.error("Something happened")- Whether the package works with Python versions beyond 3.8, given classifiers list only up to 3.8.
- Current compatibility with recent Loki API versions, given the gap since last release in 2019-11-28.
What it is and what it does
python-logging-loki is a Python logging handler that integrates with Grafana Loki, a log aggregation system. It captures log records from Python's standard logging module and ships them to a Loki instance via HTTP POST requests, attaching custom labels to organize and filter logs. The handler supports basic authentication and can operate in blocking mode or asynchronously via Python's built-in QueueHandler and QueueListener to avoid blocking application threads.
The package depends on requests for HTTP communication and rfc3339 for timestamp handling. It is designed for developers running Loki as their log backend who want to centralize Python application logs. The handler automatically includes message severity, logger name, and custom tags in each log entry sent to Loki.
Use it for
- Centralize Python application logs into Grafana Loki for unified log aggregation and querying.
- Send application error and warning logs to Loki with custom labels for service identification.
- Integrate Python services with a Loki-based observability stack without external log shipping agents.
- Asynchronously forward logs to Loki using QueueHandler to avoid blocking application performance.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you run Grafana Loki and need to ship Python logs to it.
The package is straightforward, has low dependencies, and carries no known vulnerabilities. However, maintenance is dormant since 2019-11-28, so compatibility with recent Loki API changes or Python versions beyond 3.8 is unverified. For active projects, confirm the handler works with your Loki version before relying on it in production.
Install
python-logging-loki on PyPI
Before you install
Low install friction with only 2 runtime dependencies (rfc3339, requests). Maintenance is dormant—last release was 2019-11-28 and last commit 2024-05-14—but the repository remains unarchived with 171 stars.
Requires a reachable Loki instance endpoint and network connectivity to push logs.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install python-logging-loki
import logging
import python_logging_loki
handler = python_logging_loki.LokiHandler(
url="https://my-loki-instance/loki/api/v1/push",
tags={"application": "my-app"},
auth=("username", "password"),
version="1"
)
logger = logging.getLogger("my-logger")
logger.addHandler(handler)
logger.error("Something happened")
Verify before relying
- Whether the package works with Python versions beyond 3.8, given classifiers list only up to 3.8.
- Current compatibility with recent Loki API versions, given the gap since last release in 2019-11-28.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesrfc3339requests |
| Maintenance | Dormant 2,451 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,067,188 / month, #4,410 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Logging |
Evidence: python_logging_loki-0.3.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “send logs to loki”
- python-logging-lokiA Python logging handler that sends log records to Grafana Loki via…
- loki-logger-handlerA logging handler that sends Python log messages to Grafana Loki in…
- coslProvides utilities for COS Lite charms, including bindings for…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also loki-logger-handler · orchestra-sdk · splunk-hec-handler · aws-logging-handlers · logging-tree · rfc5424-logging-handler · pygelf · logzio-python-handler · grafanalib · r7insight-python