一、方案前置准备(服务器环境:CentOS7+,内存≥4G)
1. 基础依赖安装
统一部署Elastic 7.17.9稳定版工具链,避免版本兼容问题,执行以下命令:
- 导入GPG密钥并添加仓库:
```bash
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cat > /etc/yum.repos.d/elastic.repo << EOF
[elastic-7.x]
name=Elastic repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
```
- 安装核心工具:
```bash
yum install elasticsearch-7.17.9 kibana-7.17.9 filebeat-7.17.9 -y
```
关键配置:修改Elasticsearch内存配额,编辑/etc/elasticsearch/jvm.options,将`-Xms1g`、`-Xmx1g`改为`-Xms2g`、`-Xmx2g`;开放服务端口:
```bash
firewall-cmd --add-port=9200/tcp --permanent
firewall-cmd --add-port=5601/tcp --permanent
firewall-cmd --reload
```
二、核心日志采集规则配置
1. Filebeat采集逻辑编写
编辑Filebeat配置文件/etc/filebeat/filebeat.yml,替换为以下完整可执行内容:
```yaml
filebeat.inputs:
- type: log
enabled: true
paths:
替换为你的数字档案馆实际日志路径
- /opt/digital-archive/logs/.log
fields:
log_type: archive_system_behavior
fields_under_root: true
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
output.elasticsearch:
hosts: ["http://localhost:9200"]
username: "elastic"
password: "your_elastic_password" 替换为Elasticsearch初始密码
setup.kibana:
host: "http://localhost:5601"
setup.dashboards.enabled: true
```
必填修改项:1. 替换paths后的值为你的数字档案馆日志目录;2. 修改your_elastic_password为Elasticsearch的实际登录密码(初始密码可在Elastic启动后通过命令查看)。
三、审计规则与告警设置
1. 异常行为告警配置

打开Kibana(http://服务器IP:5601),登录后按以下步骤设置:
- 点击【Stack Management】→【Alerting】→【Create rule】;
- 选择阈值告警类型,查询条件输入:`action.keyword:delete AND resource_type.keyword:archive_file`;
- 时间范围设为5分钟,阈值设为1(5分钟内触发1次则告警);
- 配置告警名称为「档案删除异常告警」,选择邮件告警方式,填入SMTP参数(以QQ邮箱为例):
```yaml
xpack.notification.email.account:
smtp_alert:
profile: standard
email: "your_alarm@qq.com"
smtp:
host: "smtp.qq.com"
port: 465
secure: true
auth: true
user: "your_qq@qq.com"
password: "QQ邮箱授权码"
```
四、审计报表可视化生成
1. 自定义审计仪表盘
在Kibana首页操作:
- 点击【Dashboard】→【Create dashboard】→【Add visualization】;
- 添加登录行为趋势图:选择Line chart,X轴为`@timestamp`,Y轴为Count,过滤器为`action.keyword:login`,保存为「登录行为周趋势」;
- 添加档案修改统计图:选择Bar chart,X轴为`date_histogram`,Y轴为Count,过滤器为`action.keyword:modify`,保存为「修改行为月统计」;
- 拖动两个图表到同一仪表盘,命名为「数字档案馆系统行为审计总览」,点击【Save】完成。
五、落地验证步骤
1. 最小测试用例执行
按顺序执行以下验证操作:
- 服务启动校验:执行`systemctl start elasticsearch kibana filebeat`,再执行`systemctl status elasticsearch`,确认显示`active (running)`,若失败查看/var/log/elasticsearch/下日志排错;
- 模拟操作:登录数字档案馆后台,创建1条测试档案,删除1条测试档案;
- 数据验证:打开Kibana【Discover】,索引选`filebeat-`,搜索`action.keyword:delete`,确认能搜到删除操作记录;
- 告警验证:查看配置的告警邮箱,确认收到「档案删除异常告警」邮件,若未收到检查SMTP配置与端口。
完成以上步骤后,数字档案馆系统行为审计方案即可全流程落地,所有核心操作可通过Kibana可视化界面直接管理,无需额外代码修改。