diff --git a/keep/api/logging.py b/keep/api/logging.py index a91659457..88be1bf08 100644 --- a/keep/api/logging.py +++ b/keep/api/logging.py @@ -17,6 +17,10 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) +KEEP_STORE_WORKFLOW_LOGS = ( + os.environ.get("KEEP_STORE_WORKFLOW_LOGS", "true").lower() == "true" +) + class WorkflowDBHandler(logging.Handler): def __init__(self): @@ -25,6 +29,8 @@ def __init__(self): def emit(self, record): # we want to push only workflow logs to the DB + if not KEEP_STORE_WORKFLOW_LOGS: + return if hasattr(record, "workflow_execution_id") and record.workflow_execution_id: self.records.append(record) @@ -155,6 +161,7 @@ def dump(self): None, ) if workflow_db_handler: + self.logger.info("Pushing logs to DB") workflow_db_handler.push_logs_to_db() else: self.logger.warning("No WorkflowDBHandler found") diff --git a/pyproject.toml b/pyproject.toml index 624be05b5..bb9e9fe79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "keep" -version = "0.33.4" +version = "0.33.5" description = "Alerting. for developers, by developers." authors = ["Keep Alerting LTD"] packages = [{include = "keep"}]