question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

django-health-check with django-audit-log

See original GitHub issue

Hi, I am trying to ignore django health check’s TestModel from the auditlog app, but it doesn’t seem to work. Here is my setting,

# django auditlog
AUDITLOG_INCLUDE_ALL_MODELS = True
AUDITLOG_EXCLUDE_TRACKING_MODELS = (
    "health_check",
    "health_check.db.models.TestModel"
)

No matter what combination I add here, it always logs create, update, delete actions for the TestModel object. Any insights on how I can ignore this model?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
rahulkp220commented, Oct 11, 2022

Hi @2ykwang , your question led me to the solution 😃

I started testing as you suggested,

./manage.py shell --settings myproject.settings

>> from django.apps import apps
>> apps.all_models["health_check"]
>> {}

However, I given I had the following in my INSTALLED_APPS

    "health_check",
    "health_check.db",
    "health_check.cache",
    "health_check.storage",
    "health_check.contrib.migrations",
    "health_check.contrib.redis",

But, upon further checking, I found that django-health-check was storing the app names as

>> apps.all_models(
defaultdict(dict,
             ....
             'health_check': {},
             'db': {'testmodel': health_check.db.models.TestModel},
             'cache': {},
             'storage': {},
             'migrations': {},
             'redis': {},
             ....
)

So, I went ahead and added just db in my setting like this,

AUDITLOG_EXCLUDE_TRACKING_MODELS = (
    "db",
)

and it works now! 🎉 Thank you!

1reaction
hramezanicommented, Oct 11, 2022

@2ykwang Could you please take a look?

Read more comments on GitHub >

github_iconTop Results From Across the Web

django-health-check
This project checks for various conditions and provides reports when anomalous behavior is detected. The following health checks are bundled with this project:....
Read more >
datapunt-django-audit-log
DataPunt Audit Log is a simple Django app that will log all incoming requests and their corresponding responses to a configurable endpoint.
Read more >
django-health-check — Python documentation
This project checks for various conditions and provides reports when anomalous behavior is detected. Many of these checks involve connecting to back-end ...
Read more >
Logging
Package django‑health‑check django‑auditlog Django GUID (Correlation‑ID) Category App App App # Using This 5 3 0 Development Status Production/Stable Unknown Production/Stable
Read more >
Django Health Check
Description. A pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found