Skip to content

Ragib01/django_log_tracker

Repository files navigation

django_log_tracker: A Django app to conduct api logs

version Downloads Downloads Downloads Open Source

GitHub

It logs all the API information for content type "application/json".

Database fields:

  • status
  • api
  • method
  • headers
  • client_ip_address
  • client_ip_geolocation
  • response
  • status_code
  • execution_time
  • user_agent
  • added_on

Installation

  1. PyPI
pip install django-log-tracker
  1. Install requests
pip install requests
  1. Add "django_log_tracker" to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
    ...,
    'django_log_tracker',
]
  1. Add in MIDDLEWARE
MIDDLEWARE = [
    ...,
    'django_log_tracker.middleware.log_tracker_middleware.LogTrackerMiddleware',
]
  1. Run
python manage.py migrate

Add these lines in settings file.

Store logs into the database

Log every request into the database.

DJANGO_LOG_TRACKER_DATABASE = True  # Default to False
  • Logs will be available in Django Admin Panel.

logs

  • The search bar will search in Request Body, Response, Headers and API URL.

search-bar

  • You can also filter the logs based on the "added_on" date, Status Code and Request Methods.

filter

Track client ip address

ip

DJANGO_LOG_TRACKER_IP = True # Default to False

Track client ip geolocation

DJANGO_LOG_TRACKER_IP_GEOLOCATION = True # Default to False

Note:

API response may get slower for DJANGO_LOG_TRACKER_IP and DJANGO_LOG_TRACKER_IP_GEOLOCATION. So by default they both are false.

API Data into Charts

chart

Check version

>>> import django_log_tracker
>>> django_log_tracker.__version__

About

A Django app to conduct api logs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published