.. _filestore-update-v1-to-v2:

21.5.1. 文件存储配置从V1升级至V2指南

假设现有文件存储配置如下:

- file-store:
    enabled: yes        # 设为yes启用功能
    log-dir: files      # 文件存储目录
    force-magic: no     # 强制对所有存储文件记录magic信息
    force-hash: [md5]   # 强制记录md5校验值
    force-filestore: no # 强制存储所有文件
    stream-depth: 1mb   # 重组1MB数据流,设为no则禁用
    waldo: file.waldo   # 用于跨运行保存file_id的标记文件
    max-open-files: 0   # 保持打开的文件数(0表示不保持)
    write-meta: yes     # 设为yes时生成.meta元数据文件
    include-pid: yes    # 设为yes时在文件名中包含进程ID

升级至V2版本配置需进行以下变更:

  • 必须添加 version 字段并设为2

  • log-dir 字段应重命名为 dir。建议使用新目录而非现有V1目录

  • 移除 waldo 选项(该功能已废弃)

  • 移除 write-meta 选项

  • 可选设置 write-fileinfo 来启用元数据文件生成(默认禁用,因 fileinfo 事件可写入Eve日志文件)

  • 移除 include-pid 选项(V2版本无等效功能)

转换后的配置示例:

- file-store:
    version: 2
    enabled: yes
    dir: filestore
    force-hash: [md5]
    file-filestore: no
    stream-depth: 1mb
    max-open-files: 0
    write-fileinfo: yes

关于V2版本文件存储目录格式的详细信息,请参阅手册中的 文件提取 章节。