Skip to content

Releases: vishalanandl177/DRF-API-Logger

Identify slow APIs and Delete permissions added

07 Jun 14:10
Compare
Choose a tag to compare

You can also identify slow APIs by specifying DRF_API_LOGGER_SLOW_API_ABOVE in settings.py.

A new filter (By API Performance) will be visible, and you can choose slow or fast API.
DRF_API_LOGGER_SLOW_API_ABOVE = 200 # Default to None
Now you can delete the DRF API Logger using the admin panel.

Hide Sensitive Data From Logs and Change default database to store API logs

04 Jun 15:08
Compare
Choose a tag to compare

You may wish to hide sensitive information from being exposed in the logs.
You do this by setting DRF_API_LOGGER_EXCLUDE_KEYS in settings.py to a list of your desired sensitive keys.
The default is
DRF_API_LOGGER_EXCLUDE_KEYS = ['password', 'token', 'access', 'refresh']
Sensitive data will be replaced with "FILTERED".

You can specify the database where to store DRF API Logger logs by specifying DRF_API_LOGGER_DEFAULT_DATABASE.
DRF_API_LOGGER_DEFAULT_DATABASE = 'default' # Default to "default" if not specified
Make sure to migrate the database specified in DRF_API_LOGGER_DEFAULT_DATABASE.

Logging everything issue fixed

03 Apr 07:35
Compare
Choose a tag to compare

Logging everything issue fixed.
A new graph added to show the number of API calls by status code.

Migration file added

09 Mar 16:29
Compare
Choose a tag to compare

Migration file added and license changed to MIT.

No such file or directory: 'README.md' Bug Fixed

28 Feb 07:13
Compare
Choose a tag to compare

Improvements and model usage.

22 Feb 19:21
Compare
Choose a tag to compare

You can use the DRF API Logger Model to query some information.

Note: Make sure to set "DRF_API_LOGGER_DATABASE = True" in the settings.py file.

from drf_api_logger.models import APILogsModel

"""
Example:
Select records for status_code 200.
"""
result_for_200_status_code = APILogsModel.objects.filter(status_code=200)

Model:

class APILogsModel(Model):
   id = models.BigAutoField(primary_key=True)
   api = models.CharField(max_length=512, help_text='API URL')
   headers = models.TextField()
   body = models.TextField()
   method = models.CharField(max_length=10, db_index=True)
   client_ip_address = models.CharField(max_length=50)
   response = models.TextField()
   status_code = models.PositiveSmallIntegerField(help_text='Response status code', db_index=True)
   execution_time = models.DecimalField(decimal_places=5, max_digits=8,
                                       help_text='Server execution time (Not complete response time.)')
   added_on = models.DateTimeField()

Showing count of per-day API calls in chart. (Rebuilding)

18 Feb 21:49
Compare
Choose a tag to compare

Make sure to add the code below in settings.py

'DIRS': [os.path.join(BASE_DIR, 'templates')],

The final code should look like this.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Showing count of per-day API calls in chart. (Rebuilding)

18 Feb 21:15
Compare
Choose a tag to compare

Showing count of per-day API calls in chart.

18 Feb 20:43
Compare
Choose a tag to compare
1.0.0

Merge branch 'master' of https://github.com/vishalanandl177/DRF-API-L…

Fix error when response has no content-type

05 Jan 22:57
Compare
Choose a tag to compare
0.0.9

Fix error when response has no content-type