使用rsync备份Windows事件日志
Windows版软件:cwRsyncServer
安装比较简单一直下一步即可,输入到创建账号页面的时候可以自己设置一个密码。
<code>服务器端:cwRsyncServer_4.0.5_Installe.zip 客户端:cwRsync_4.0.5_Installer.zip</code>
由于特殊原因需要收集Windows的Application、Security、Setup、System事件日志,而事件日志的位置是在C:WindowsSystem32winevtLogs当中,经测试rsync无法同步此目录的文件,因此采用硬链接的方式将其链接到另一个目录。
正文
- 创建硬链接
<code>echo off md C:Eventlog mklink /H C:EventlogSystem.evtx C:WindowsSystem32winevtLogsSystem.evtx mklink /H C:EventlogSetup.evtx C:WindowsSystem32winevtLogsSetup.evtx mklink /H C:EventlogSecurity.evtx C:WindowsSystem32winevtLogsSecurity.evtx mklink /H C:EventlogApplication.evtx C:WindowsSystem32winevtLogsApplication.evtx</code>
- rsync服务端
配置文件
<code>use chroot = false strict modes = false log file = rsyncd.log pid file = rsyncd.pid port = 8173 #默认端口8173 uid = 0 #不指定uid,不加这一行将无法使用任何账户 gid = 0 #不指定gid max connections = 20 #最大连接数20 hosts allow = IP #此处写允许连接的IP read only = yes [模块名] path = /cygdrive/e/路径/ #“/cygdrive/e/”不可更改,后面写路径 transfer logging = yes lock file = rsyncd.lock read only = false #关闭只读,使用rsync客户端推送,因此需要关闭 log file = #此处记录传输日志,写路径</code>
配置好之后启动服务,并在防火墙开放8173端口。
- 客户端
bat脚本
<code>echo off c: cd C:Program Files (x86)ICWBin rsync -avzP --progress --checksum --port=8173 /cygdrive/c/路径/ 服务端IP::模块名</code>
客户端(推送端)bat脚本
<code>schtasks /create /sc minute /mo 5 /tn "rsync" /st 00:00 /tr C: sync syslog.bat /ru System #cmd 创建计划任务“rsync”,使用系统账户从当天0点开始每5分钟执行一次脚本rsyslog.bat </code>
也可以手动创建计划任务
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!