skillfed

Flask-Log-Request-ID

Flask extension that can parse and handle multiple types of request-id sent by request processors like Amazon ELB, Heroku or any multi-tier infrastructure as the one used for microservices.

flask-log-request-id v0.10.1 121.3K downloads/30d#11,985 on PyPI115
Permissive license MIT DORMANT released

What it is and what it does

Flask-Log-Request-ID is a Flask extension that captures request IDs from HTTP headers (commonly set by load balancers like Amazon ELB or Heroku) and makes them available throughout your application's request lifecycle. It provides a RequestIDLogFilter that automatically injects the request ID into all log records, including those from third-party libraries, enabling you to trace a single user request across multiple services and log files.

The package is designed for microservices and multi-tier infrastructure where a request passes through several layers. By attaching the same request ID to every log entry, you can correlate logs across services and dramatically simplify debugging. It exposes a current_request_id() function to retrieve the ID at any point in your code, and includes support for forwarding the request ID to Celery workers.

Use it for:

  • Correlate logs across multiple Flask microservices by injecting a common request ID into all log records.
  • Debug production issues by tracing a single user request through multiple services using a unified request ID.
  • Forward request IDs to background Celery tasks so async work maintains the same tracing context.
  • Integrate with load balancer request tracing (ELB, Heroku) to preserve infrastructure-level request IDs in application logs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extracts request IDs from incoming HTTP requests (from load balancers or infrastructure) and injects them into Flask application logs for distributed tracing.

Yes, with caution. The package is simple, stable, and solves a real problem in microservice logging. However, maintenance is dormant since 2019 with no recent commits—test compatibility with your Flask version before deploying to production. If you need active support or are using very recent Flask releases, consider whether a more actively maintained alternative exists.

Install

flask-log-request-id on PyPI

pip

pip install flask-log-request-id

uv

uv add flask-log-request-id

poetry

poetry add flask-log-request-id

Installing Flask-Log-Request-ID

Before you install

Low friction: single runtime dependency on Flask, pure Python wheel. Maintenance is dormant—last release October 2019, no commits since July 2024—but the package is stable and archived repository shows no active development planned.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install flask-log-request-id

import logging
from flask import Flask
from flask_log_request_id import RequestID, RequestIDLogFilter

app = Flask(__name__)
RequestID(app)

handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(request_id)s - %(message)s"))
handler.addFilter(RequestIDLogFilter())
logging.getLogger().addHandler(handler)

Verify before relying

  • Whether the package works correctly with modern Flask versions (3.0+) given the dormant maintenance status since 2019.
  • Compatibility with current Python versions and whether any undocumented breaking changes exist in recent Flask releases.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — Flask
Maintenance dormant — 2,479 days since the last release
Last repo commit
First released
Downloads 121,332/month — #11,985 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: Flask_Log_Request_ID-0.10.1-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

request id logging flaskdistributed tracing flaskrequest tracking logsflask request correlation idmicroservice request tracingelb heroku request idflask log context injection
microservicesrequest-tracinglogging

More Python Modules packages