Skip to content

Django Log Panel

PyPI Latest on Django Packages

django-log-panel displays your Django logs inside Django admin as a per-logger status dashboard with searchable log entries and optional threshold alerts.

Log panel dashboard showing per-logger health cards

Log panel dashboard showing a 90 day logger timeline

Log detail view with message search and paginated entries Log detail view with the level filter dropdown open

Features

  • A status-page style dashboard in Django admin, with one health card per logger.
  • A searchable, filterable log table for drilling into individual entries.
  • MongoDB and SQL storage backends, depending on how you want to store logs.
  • Threshold alerts through a Django signal that your application can react to.
  • Configurable ranges, colors, page size, title, and access control.
  • Automatic root-handler setup by default, with manual LOGGING control when needed.

Requirements

  • Python >= 3.12
  • Django >= 5.2
  • django-mongodb-backend only when using the MongoDB backend (version must match your Django version, e.g. 5.2.x for Django 5.2, 6.0.x for Django 6.0)
  • A running, reachable MongoDB instance when using the MongoDB backend

Installation

uv add django-log-panel
pip install django-log-panel

For MongoDB support, install the optional extra:

uv add "django-log-panel[mongodb]"
pip install "django-log-panel[mongodb]"

Choose a backend

  • MongoDB — document storage with cheap writes.
  • SQL — logs in a relational database.
  • Customwrite your own backend by subclassing LogsBackend.

Both built-in backends use the same Log model, DatabaseHandler, and ORM queries. The only difference is the ENGINE in your DATABASES entry. Retention is managed by running the delete_old_logs management command on a schedule.

Quick start

1. Add the app

INSTALLED_APPS = [
    ...,
    "log_panel",
]

2. Configure one backend

DATABASES["logs"] = {
    "ENGINE": "django_mongodb_backend",
    "HOST": "mongodb://localhost:27017",
    "NAME": "myapp_logs",
}

DATABASE_ROUTERS = [
    "log_panel.routers.LogsRouter",
]

LOG_PANEL = {
    "DATABASE_ALIAS": "logs",
    "RETENTION_DAYS": 90,
}
DATABASES["logs"] = {
    "ENGINE": "django.db.backends.postgresql",
    "NAME": "myapp_logs",
    "USER": "...",
    "PASSWORD": "...",
    "HOST": "...",
    "PORT": "...",
}

DATABASE_ROUTERS = [
    "log_panel.routers.LogsRouter",
]

LOG_PANEL = {
    "DATABASE_ALIAS": "logs",
    "RETENTION_DAYS": 90,
}

Then run the migration on the logging database:

python manage.py migrate log_panel --database=logs

To delete old logs, run the cleanup command on a schedule:

python manage.py delete_old_logs

3. Open Django admin

Go to Log Panel, or open:

/admin/log_panel/log/

Once configured, any standard Python logger that flows through the selected handler will show up in the panel.

How log capture works

  • LOG_PANEL selects how the admin reads log data.
  • By default, log_panel auto-attaches a DatabaseHandler to the root logger at startup.
  • Set ATTACH_ROOT_HANDLER = False when you want full control through Django LOGGING.
  • LOG_LEVEL only affects the auto-attached root handler.
  • Stored fields come from the log record itself; LOGGING formatters do not reshape the stored data.

Full setup notes and manual LOGGING examples are in the backend guide.

What's next?