|
104 | 104 | LOGIN_REDIRECT_URL=(str, "/admin/"), |
105 | 105 | LOGOUT_REDIRECT_URL=(str, "/admin/"), |
106 | 106 | OPENSHIFT_BUILD_COMMIT=(str, ""), |
| 107 | + # Resilient logger config |
| 108 | + AUDIT_LOG_ENV=(str, ""), |
| 109 | + AUDIT_LOG_ES_URL=(str, ""), |
| 110 | + AUDIT_LOG_ES_INDEX=(str, ""), |
| 111 | + AUDIT_LOG_ES_USERNAME=(str, ""), |
| 112 | + AUDIT_LOG_ES_PASSWORD=(str, ""), |
107 | 113 | ) |
108 | 114 |
|
109 | 115 | if os.path.exists(env_file): |
@@ -242,6 +248,7 @@ def sentry_traces_sampler(sampling_context: SamplingContext) -> float: |
242 | 248 | "django_admin_listfilter_dropdown", |
243 | 249 | "auditlog", |
244 | 250 | "auditlog_extra", |
| 251 | + "resilient_logger", |
245 | 252 | "health_check", |
246 | 253 | # local apps under this line |
247 | 254 | "custom_health_checks", |
@@ -571,3 +578,27 @@ def sentry_traces_sampler(sampling_context: SamplingContext) -> float: |
571 | 578 |
|
572 | 579 | # Load auditlog settings |
573 | 580 | from palvelutarjotin.auditlog_settings import * # noqa: E402, F403 |
| 581 | + |
| 582 | +RESILIENT_LOGGER = { |
| 583 | + "origin": "kultus-api", |
| 584 | + "environment": env("AUDIT_LOG_ENV"), |
| 585 | + "sources": [ |
| 586 | + { |
| 587 | + "class": "resilient_logger.sources.DjangoAuditLogSource", |
| 588 | + } |
| 589 | + ], |
| 590 | + "targets": [ |
| 591 | + { |
| 592 | + "class": "resilient_logger.targets.ElasticsearchLogTarget", |
| 593 | + "es_url": env("AUDIT_LOG_ES_URL"), |
| 594 | + "es_username": env("AUDIT_LOG_ES_USERNAME"), |
| 595 | + "es_password": env("AUDIT_LOG_ES_PASSWORD"), |
| 596 | + "es_index": env("AUDIT_LOG_ES_INDEX"), |
| 597 | + "required": True, |
| 598 | + } |
| 599 | + ], |
| 600 | + "batch_limit": 5000, |
| 601 | + "chunk_size": 500, |
| 602 | + "submit_unsent_entries": True, |
| 603 | + "clear_sent_entries": True, |
| 604 | +} |
0 commit comments