@profullstack/threatcrush 0.13.25 → 0.13.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -36059,6 +36059,7 @@ async function installServiceCommand() {
36059
36059
  console.log(source_default.dim(" Installing with a system Node (/usr/bin/node or /usr/local/bin/node) avoids this."));
36060
36060
  }
36061
36061
  ensureSystemDirs(configDir);
36062
+ installLogrotate();
36062
36063
  stopUserModeDaemon();
36063
36064
  try {
36064
36065
  (0, import_node_child_process13.execSync)("systemctl daemon-reload", { stdio: "inherit" });
@@ -36080,6 +36081,33 @@ async function installServiceCommand() {
36080
36081
  }
36081
36082
  console.log();
36082
36083
  }
36084
+ var LOGROTATE_PATH = "/etc/logrotate.d/threatcrush";
36085
+ function renderLogrotate(logDir = "/var/log/threatcrush") {
36086
+ return [
36087
+ "# Installed by `threatcrush install-service`.",
36088
+ `${logDir}/*.log {`,
36089
+ " daily",
36090
+ " maxsize 200M",
36091
+ " rotate 7",
36092
+ " compress",
36093
+ " delaycompress",
36094
+ " missingok",
36095
+ " notifempty",
36096
+ " create 0644 root root",
36097
+ " su root root",
36098
+ "}",
36099
+ ""
36100
+ ].join("\n");
36101
+ }
36102
+ function installLogrotate() {
36103
+ if (!(0, import_node_fs37.existsSync)((0, import_node_path26.dirname)(LOGROTATE_PATH))) return;
36104
+ try {
36105
+ (0, import_node_fs37.writeFileSync)(LOGROTATE_PATH, renderLogrotate(), { mode: 420 });
36106
+ console.log(source_default.green(` \u2713 Log rotation: ${LOGROTATE_PATH} (daily or 200M, keeps 7)`));
36107
+ } catch (err) {
36108
+ console.log(source_default.yellow(` ! Could not install log rotation: ${err.message}`));
36109
+ }
36110
+ }
36083
36111
  function ensureSystemDirs(configDir) {
36084
36112
  const dirs = [
36085
36113
  { path: "/etc/threatcrush", groupWritable: true },