Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 577ab58

Browse files
[backend/worker] Adapt logging strategy to improve the error management
1 parent 3284e1e commit 577ab58

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,9 +2570,6 @@ def import_item(
25702570
in_retry = processing_count < PROCESSING_COUNT
25712571
# Platform is under heavy load, wait for unlock & retry indefinitely.
25722572
if ERROR_TYPE_LOCK in error_msg:
2573-
worker_logger.info(
2574-
"Message reprocess for lock rejection", {"count": processing_count}
2575-
)
25762573
bundles_lock_error_counter.add(1)
25772574
sleep_jitter = round(random.uniform(1, 3), 2)
25782575
time.sleep(sleep_jitter)
@@ -2581,10 +2578,6 @@ def import_item(
25812578
)
25822579
# Platform detects a missing reference and have to retry
25832580
elif ERROR_TYPE_MISSING_REFERENCE in error_msg and in_retry:
2584-
worker_logger.info(
2585-
"Message reprocess for missing reference",
2586-
{"count": processing_count},
2587-
)
25882581
bundles_missing_reference_error_counter.add(1)
25892582
sleep_jitter = round(random.uniform(1, 3), 2)
25902583
time.sleep(sleep_jitter)
@@ -2593,8 +2586,7 @@ def import_item(
25932586
)
25942587
# A bad gateway error occurs
25952588
elif ERROR_TYPE_BAD_GATEWAY in error_msg:
2596-
worker_logger.error("A connection error occurred")
2597-
worker_logger.info(
2589+
worker_logger.error(
25982590
"Message reprocess for bad gateway",
25992591
{"count": processing_count},
26002592
)
@@ -2605,8 +2597,7 @@ def import_item(
26052597
)
26062598
# Request timeout error occurs
26072599
elif ERROR_TYPE_TIMEOUT in error_msg:
2608-
worker_logger.error("A connection error occurred")
2609-
worker_logger.info(
2600+
worker_logger.error(
26102601
"Message reprocess for request timed out",
26112602
{"count": processing_count},
26122603
)
@@ -2619,10 +2610,6 @@ def import_item(
26192610
# That also works for missing reference with too much execution
26202611
else:
26212612
bundles_technical_error_counter.add(1)
2622-
worker_logger.error(
2623-
"Error executing import",
2624-
{"count": processing_count, "reason": error},
2625-
)
26262613
if work_id is not None:
26272614
item_str = json.dumps(item)
26282615
self.opencti.work.report_expectation(

0 commit comments

Comments
 (0)