23 lines
608 B
Python
23 lines
608 B
Python
import logging
|
|
|
|
from django.apps import AppConfig
|
|
from django.conf import settings
|
|
|
|
_log = logging.getLogger()
|
|
|
|
started = False
|
|
|
|
TEST_MODE = getattr(settings, "TEST_MODE", False)
|
|
|
|
|
|
class LogstashConfig(AppConfig):
|
|
name = 'logstash'
|
|
|
|
def ready(self):
|
|
if not TEST_MODE:
|
|
global started
|
|
if not started:
|
|
from logstash.tasks import initial_task_update
|
|
res = initial_task_update.apply_async(countdown=60, args=(False))
|
|
_log.info(f"Starting correlator rules initialization with task id {res.id}")
|
|
started = True
|