Skip to content

Settings

Natán edited this page Mar 24, 2019 · 5 revisions

Django Easy Audit allows some level of configuration. In the project's settings.py file, you can define the following settings:

What to audit

  • DJANGO_EASY_AUDIT_WATCH_MODEL_EVENTS

    Defines whether to log model related events, such as when an object is created, updated, or deleted. Defaults to True.

  • DJANGO_EASY_AUDIT_WATCH_AUTH_EVENTS

    Defines whether to log user authentication events, such as logins, logouts and failed logins. Defaults to True.

  • DJANGO_EASY_AUDIT_WATCH_REQUEST_EVENTS

    Defines whether to log URL requests made to the project. Defaults to True

Model auditing

  • DJANGO_EASY_AUDIT_UNREGISTERED_CLASSES_DEFAULT

    A list of models that by default Easy Audit won't log. Don't overwrite this setting unless you know what you're doing; it may create an infinite loop and break the project. If you want Easy Audit to stop logging one or more of the project's models, use the following setting.

  • DJANGO_EASY_AUDIT_UNREGISTERED_CLASSES_EXTRA

    A user defined list of models that Easy Audit will ignore (besides the default ignored models). This is the setting you should use to stop logging one or more of the project's models. List items can be classes or strings with app_name.model_name format. Defaults to [].

  • DJANGO_EASY_AUDIT_REGISTERED_CLASSES

    A list of models Easy Audit will log. If it is set, only the models in this list will be logged, and every other model will be ignored. (Note: this setting doesn't override the unregistered classes settings.) List items can be classes or strings with app_name.model_name format. Defaults to [].

Request auditing

  • DJANGO_EASY_AUDIT_UNREGISTERED_URLS_DEFAULT

    A list of URLs that by default Easy Audit will ignore. Don't overwrite this setting unless you know what you are doing; you may end up with a lot of entries very fast. If you want Easy Audit to stop logging requests to one or more URLs, use the following setting.

    Important: this setting expects a list of regular expressions, which will be matched against the path of the request (that is, without the domain). Very similar to how urlpatterns work in Django, but with a leading slash.

    Defaults to [r'^/admin/', r'^/static/', r'^/favicon.ico$']. This means that by default Easy Audit will not log requests made to the admin app or to static files.

  • DJANGO_EASY_AUDIT_UNREGISTERED_URLS_EXTRA

    A user defined list of URLs that Easy Audit will ignore (besides the default ignored URLs). It expects a list of regular expressions, exactly like the previous setting.

  • DJANGO_EASY_AUDIT_REGISTERED_URLS

    A list of URLs Easy Audit will log. If it is set, only the URLs in this list will be logged, and every other URL will be ignored. (Note: this setting doesn't override the unregistered URLs settings.) It expects a list of regular expressions, exactly like the previous setting.

Django admin site

  • DJANGO_EASY_AUDIT_ADMIN_SHOW_MODEL_EVENTS

  • DJANGO_EASY_AUDIT_ADMIN_SHOW_AUTH_EVENTS

  • DJANGO_EASY_AUDIT_ADMIN_SHOW_REQUEST_EVENTS

    Set these to False to prevent Django Easy Audit from registering one or more of the auditing models in the Django admin site. Note that this won't stop the app from logging events; it will just not show them in the admin. If you want to stop logging model, auth or request events, check the section What to audit.

Clone this wiki locally