Minecraft 有一个这样的日志文件:
2012-10-27 21:45:47 [INFO] Starting Minecraft server on *:25565
2012-10-27 21:45:47 [INFO] Preparing level "../worlds/world3"
2012-10-27 21:45:48 [INFO] Preparing start region for level 0
2012-10-27 21:45:49 [INFO] Preparing spawn area: 16%
2012-10-27 21:45:50 [INFO] Preparing spawn area: 41%
2012-10-27 21:45:51 [INFO] Preparing spawn area: 75%
2012-10-27 21:45:51 [INFO] Done (4.082s)! For help, type "help" or "?"
2012-10-27 21:46:06 [INFO] foo[/12.34.56.78:50371] logged in with entity id 661 at (64.03178036049653, 76.0, -53.74201593751356)
2012-10-27 21:46:13 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
这个日志文件能被 rsyslog 监控吗?似乎 imfile 模块将所有消息放在一个严重性组中,而且看起来它没有使用时间。我是 syslog 的新手,所以也许我忽略了一些显而易见的东西。
答案1
只需将其作为任意文件添加到 Syslog 即可
另外。/etc/rsyslog.conf
$ModLoad imfile
然后使用导入定义创建一个minecraft.conf
用于 minecraft 登录的文件:/etc/rsyslog.d
$InputFileName /mine/logs/latest.log
$InputFileTag minecraft
$InputFileStateFile minecraft-file1
$InputFileSeverity info
$InputFileFacility local7
$InputRunFileMonitor
$InputFilePersistStateInterval 500
仍在尝试清理一下日志