如何配置linux rsyslogd将特定的本地文件发送到远程服务器

问题描述

我尝试了几种方法,但均无效果。您能帮忙吗?:

在我的本地Ubuntu 18.04服务器上具有/ var / log / syslog。希望将此文件发送到可以成功ping通的主机。尝试了这些,日志文件未发送到远程主机。

cmx:/etc/rsyslog.d #dpkg -l | grep rsyslog
rc  rsyslog                              8.32.0-1ubuntu4                        amd64        reliable system and kernel logging daemon"

128.0.0.1是接收主机的IP地址,要发送的端口是6333。

第一次尝试-将所有本地日志文件发送到接收主机。

cmx:/etc/rsyslog.d #ls
50-default.conf  remotelog.conf
cmx:/etc/rsyslog.d #cat remotelog.conf
*. *  @@128.0.0.1:6333
cmx:/etc/rsyslog.d #

第二次尝试-添加重试等(以下链接中的第8.3.2节):

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/configuring-a-remote-logging-solution_configuring-basic-system-settings

cmx:/etc/rsyslog.d #cat remotelog.conf
*.* action(type="omfwd"
      queue.type="linkedlist"
      queue.filename="example_fwd"
      action.resumeRetryCount="-1"
      queue.saveOnShutdown="on"
      target="128.0.0.1" port="6333" protocol="tcp"
     )

顺便说一句,不确定上面的格式是否正确,尝试进行检查,但出现下面的错误

cmx:/etc/rsyslog.d #ps aux | grep rsyslog 
syslog      34  0.0  0.0 260736  2884 ?        Ssl  17:07   0:00 /usr/sbin/rsyslogd
root     15991  0.0  0.0  11464  1116 pts/1    S+   21:43   0:00 grep --color=auto rsyslog
cmx:/etc/rsyslog.d #/usr/sbin/rsyslogd -N 1
bash: /usr/sbin/rsyslogd: No such file or directory
cmx:/etc/rsyslog.d #ls -l /var/log/syslog
-rw-r----- 1 syslog adm 109714 Oct  8 21:14 /var/log/syslog
cmx:/etc/rsyslog.d #

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)