_cleanUpHistory() {
    const config = global.kuzzle.config.dump,
      dumpPath = path.normalize(global.kuzzle.config.dump.path);

    try {
      fs.accessSync(
        dumpPath,
        fs.constants.R_OK | fs.constants.W_OK | fs.constants.X_OK,
      );
    } catch (e) {
      return;
    }

    const dumps = fs
      .readdirSync(dumpPath)
      .map((file) => {
        const filepath = `${dumpPath}/${file}`;
        return { path: filepath, stat: fs.statSync(filepath) };
      })
      .filter((prop) => prop.stat.isDirectory())
      .sort((a, b) => {
        if (a.stat.birthtime.getTime() === b.stat.birthtime.getTime()) {
          return 0;
        }

        return a.stat.birthtime < b.stat.birthtime ? -1 : 1;
      });

    while (dumps.length >= config.history.reports) {
      const dir = dumps.shift().path;

      fs.rmdirSync(dir, { recursive: true });
    }

    for (let i = 0; i < dumps.length - config.history.coredump; i++) {
      const corefiles = this._listFilesMatching(
        path.normalize(dumps[i].path),
        "core",
      );

      if (corefiles[0]) {
        fs.unlinkSync(corefiles[0]);
      }
    }
  }
Create a dump

@param {string} suffix
@returns {Promise}