Metadata-Version: 2.2
Name: django-easy-audit-clickhouse
Version: 1.0.5
Summary: Django Easy Audit Log with ClickHouse integration
Home-page: https://github.com/houseworksinc/django-easy-audit-clickhouse
Classifier: Environment :: Plugins
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.5
Requires-Dist: django>=3.2
Requires-Dist: djangorestframework>=3.15
Requires-Dist: celery>=5.4.0
Requires-Dist: clickhouse-connect>=0.8.15
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

============================
django-easy-audit-clickhouse
============================

Build a django easy audit log with clickhouse integration on top of django-easy-audit==1.3.7.

Quick start
-----------
1. Prerequisites::
    - django==4.2
    - clickhouse-connect>=0.8.15
    - celery>=5.4.0
    - djangorestframework>=3.15

2. Add "easyaudit" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        ...
        'easyaudit',
    ]

3. Add django-easy-audit's middleware to your MIDDLEWARE (or MIDDLEWARE_CLASSES) setting like this::

    MIDDLEWARE = (
        ...
        'easyaudit.middleware.easyaudit.EasyAuditMiddleware',
    )

4. Run 'python manage.py migrate easyaudit' to create the audit models.

5. Configure the ClickHouse connection in your settings.py::

    CLICKHOUSE_HOST = 'localhost'
    CLICKHOUSE_USER = 'user'
    CLICKHOUSE_PASSWORD = 'password'
    CLICKHOUSE_DATABASE = 'default'

6. Create shared task of `send_logs_to_clickhouse` to sync data from django to clickhouse::

    @shared_task
    def send_audit_logs_to_clickhouse():
        from easyaudit.tasks import send_logs_to_clickhouse
        send_logs_to_clickhouse()

    app.conf.beat_schedule = {
        "send-logs-to-clickhouse": {
            "task": "path.to.send_logs_to_clickhouse",
            "schedule": crontab(hour=9, minute=10),  # 12:00 AM PST
        },
    }
