使用 rsyslogd 在本地和远程登录

Kyl*_*ndt 6 linux ubuntu logging syslog rsyslog

如何使用 rsyslog 使日志文件远程和本地存储?

sys*_*138 8

看起来就像配置文件中的两行一样简单:

*.* @loghost
*.* /var/log/messages
Run Code Online (Sandbox Code Playgroud)

rsyslog现在例子CONFIGS有发球像这样的一些实例。关键一:

kern.* /var/adm/kernel
kern.crit @finlandia;RFC3164fmt
kern.crit /dev/console
kern.info;kern.!err /var/adm/kernel-info

The second statement directs all kernel messages of the priority crit and 
higher to the remote host finlandia.
[...]
The third rule directs these messages to the actual console, so the person 
who works on the machine will get them, too.
Run Code Online (Sandbox Code Playgroud)


小智 5

Wouter de Bie 有一个很好的答案,但他展示了发送日志的 UDP 方法。为了通过更可靠(虽然不是 100%)的 TCP 发送它们,请使用以下内容:

\*.* @@remote.server.ip
Run Code Online (Sandbox Code Playgroud)