由于等保要求重要日志必须保留 180 天,而 AF 防火墙等设备建议异地保存!所以,使用 rsyslog 自行搭建一个 log 服务器。至于加入到 mysql 和 loganalyzer ,等保没有要求,以后再说
官方文档
The rocket-fast Syslog Server
RSyslog Documentation
官方仓库
rsyslog/rsyslog
ubuntu 上安装文档
Install rsyslog on Ubuntu
参考
【详解】Rsyslog配置及日志服务器搭建(rsyslog+mysql+loganalyzer)
实验环境
服务端 : 192.168.2.205 (ubuntu 20.04 虚拟机)
客户端 : 192.168.2.206 (ubuntu 20.04 虚拟机)
安装
-
按照以上安装文档,服务端和客户端都同样安装
sudo add-apt-repository ppa:adiscon/v8-devel
sudo apt-get update
sudo apt-get install rsyslog -
查看安装版本
$ rsyslogd -v
rsyslogd 8.2008.0.9d70869d4ea5 (aka 2020.08) compiled with: PLATFORM: x86_64-pc-linux-gnu PLATFORM (lsb_release -d): FEATURE_REGEXP: Yes GSSAPI Kerberos 5 support: No FEATURE_DEBUG (debug build, slow code): No 32bit Atomic operations supported: Yes 64bit Atomic operations supported: Yes memory allocator: system default Runtime Instrumentation (slow code): No uuid support: Yes systemd support: Yes Config file: /etc/rsyslog.conf PID file: /var/run/rsyslogd.pid Number of Bits in RainerScript integers: 64 See https://www.rsyslog.com for more information.
-
查看服务状态,可见已经设置为自动启动
$ sudo systemctl status rsyslog.service
$ sudo systemctl list-unit-files |grep rsyslog
-
防火墙
sudo ufw allow 514
sudo ufw allow 514/udp学习的时候可以先都关掉,之后再开启并设置
配置服务端
-
官方建议下载一份样本,学习一下