Skip to main content

Django application that provides a set of tools for auditing requests and models and improve logging

Project description

https://travis-ci.org/PeRDy/django-audit-tools.svg?branch=master https://coveralls.io/repos/PeRDy/django-audit-tools/badge.svg?branch=master&service=github Latest Version
Version:

0.3.0

Status:

Development

Author:

José Antonio Perdiguero López

Warning: This package is currently under development, use at your own risk.

Django application that provides a set of tools for auditing requests and models and improve logging.

Full documentation in ReadTheDocs.

Quick start

  1. Add audit_tools to your INSTALLED_APPS settings like this:

    INSTALLED_APPS = (
        ...
        'audit_tools',
    )
  2. Add audit.middleware.AuditMiddleware to your MIDDLEWARE_CLASSES settings like this:

    MIDDLEWARE_CLASSES = (
        ...
        'audit_tools.audit.middleware.AuditMiddleware',
    )
  3. Configure blacklisted URLs in AUDIT_BLACKLIST settings.

  4. Register models that will be logged in AUDIT_LOGGED_MODELS settings.

  5. Execute the next django command:

    python manage.py prepare_audit

Settings

AUDIT_ACTIVATE

Activate or deactivate audit.

Default:

AUDIT_ACTIVATE = True

AUDIT_DB_ALIAS

Audit database connection alias.

Default:

AUDIT_DB_ALIAS = 'audit'

AUDIT_DB_CONNECTION

Audit database connection parameters.

Default:

AUDIT_DB_CONNECTION = {
    'HOST': 'localhost',
    'PORT': 27017,
    'NAME': 'audit',
    'USER': '',
    'PASSWORD': '',
}

AUDIT_RUN_ASYNC

Use Celery to run in async mode.

Important: Celery concurrency level must be configure to 1 (–concurrency=1 parameter in celeryd start)

Default:

AUDIT_RUN_ASYNC = False

AUDIT_CELERY_QUEUE

Celery queue name.

Default:

AUDIT_CELERY_QUEUE = 'audit'

AUDIT_LOGGED_MODELS

List of models that will be logged for audit. Each entry consists in a string that represents a model using “<module>.<model>” format.

Example:

AUDIT_LOGGED_MODELS = (
    'audit_tools.audit.models.Access',
)

Default:

AUDIT_LOGGED_MODELS = ()

AUDIT_BLACKLIST

Blacklisted URLs. Each application may have a tuple of regex patterns. If an URL matches a pattern will not be logged.

Example:

AUDIT_BLACKLIST = {
    'api': (
        r'^/api/.*',
        r'^/API/.*',
    )
}

Default:

AUDIT_BLACKLIST = {}

AUDIT_ACCESS_INDEXES

Custom indexes for the accesses. There is the possibility to add new custom indexes to the Audit database.

Example:

AUDIT_ACCESS_INDEXES = [
    'custom.pools.names',
    'custom.pools.num_polls',
    ('custom.pools.names', 'custom.pools.num_polls'),
]

AUDIT_PROCESS_INDEXES

Custom indexes for the processes. There is the possibility to add new custom indexes to the Audit database.

AUDIT_MODEL_ACTION_INDEXES

Custom indexes for the model actions. There is the possibility to add new custom indexes to the Audit database.

AUDIT_CUSTOM_PROVIDER

Custom data provider. Each application may add custom data to Access entries using own functions.

Default:

AUDIT_CUSTOM_PROVIDER = {
    'audit_tools': 'audit_tools.audit.middleware.custom_provider',
}

AUDIT_TRANSLATE_URLS

Translate Audit URLs:

Default:

AUDIT_TRANSLATE_URLS = False

Changes

0.4.0 - 18/01/2015
  • Create tests for all modules.

  • Raise test coverage to near 100%.

  • Add integration with prospector using tox.

  • Add integration with Landscape.

0.3.0 - 05/01/2015
  • Use nose as testing framework.

  • Update requirements and create requirements for testing.

  • Update code to work with Django Rest Framework 3.3+.

  • Update code to work with Django Rest Framework Mongoengine 3.3+.

  • Refactor main package to make audit a subpackage from audit_tools.

  • Create a full tox.ini with coverage, nose, flake8 and sphinx.

  • Create config file for coverage.

  • Add integration with Travis CI.

  • Add integration with Coveralls.

0.2.0 - 04/01/2015
  • Create an Api to provide Process, Access and ModelAction models as resources.

  • Create a new view for searching Access models using Backbone and new Api.

  • Refactor old ModelAction searching view using Backbone and new Api and unify with new Access view.

  • Refactor middleware and signals modules to reduce method complexity and add a lot of tests.

0.1.0 - 03/01/2016
  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-audit-tools-0.4.0.tar.gz (149.0 kB view details)

Uploaded Source

Built Distribution

django_audit_tools-0.4.0-py2.py3-none-any.whl (20.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-audit-tools-0.4.0.tar.gz.

File metadata

File hashes

Hashes for django-audit-tools-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9b852231f4fd7ca1351bf8ce63173a8f4ff896d20a8362011d0cf12d857121d0
MD5 dc06075bd7f82ebebb27e23686e2f57e
BLAKE2b-256 244e8fd6d67357a989da554ddd2b23b66792d1d8ca412afa2903e8facfc8f1af

See more details on using hashes here.

File details

Details for the file django_audit_tools-0.4.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_audit_tools-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f50ca39f481442f23d8273aa8c4d0096a788cceb2693715f8389ddffad484015
MD5 6965f925572dac3a898b3143188c7b67
BLAKE2b-256 2ff1e04010c0b6a41fabf8ea278af27b02434b7e0a228d0186a7345d8ac43b05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page