Skip to content

Commit

Permalink
Enable log safe shutdown only when configured
Browse files Browse the repository at this point in the history
  • Loading branch information
bnazare committed Jan 10, 2025
1 parent 32b6506 commit 55f1339
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions opencti-platform/opencti-graphql/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"enabled": true,
"enabled_ui": true,
"enabled_dev_features": [],
"enable_logs_safe_shutdown": false,
"https_cert": {
"ca": [],
"key": null,
Expand Down
26 changes: 16 additions & 10 deletions opencti-platform/opencti-graphql/src/config/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,23 @@ export const logTelemetry = {
};

export function shutdownLoggers() {
const shutdownPromises = [appLogger, auditLogger, supportLogger].map(
(logger) => new Promise(
(resolve) => {
logger
.end()
.on('finish', resolve);
}
)
);
const safeShutdown = booleanConf('app:enable_logs_safe_shutdown', false);

if (safeShutdown) {
const shutdownPromises = [appLogger, auditLogger, supportLogger].map(
(logger) => new Promise(
(resolve) => {
logger
.end()
.on('finish', resolve);
}
)
);

return Promise.all(shutdownPromises);
}

return Promise.all(shutdownPromises);
return Promise.resolve();
}

const BasePathConfig = nconf.get('app:base_path')?.trim() ?? '';
Expand Down

0 comments on commit 55f1339

Please sign in to comment.