Ubuntu 14.04 OpenWRT:使用logread将远程日志数据发送到syslog ng客户端

Ubuntu 14.04 OpenWRT:使用logread将远程日志数据发送到syslog ng客户端,ubuntu-14.04,openwrt,syslog-ng,Ubuntu 14.04,Openwrt,Syslog Ng,我尝试远程记录我的OpenWRT系统。为此,我将/etc/config/system设置为: config system option hostname 'MySystem' option timezone 'UTC' option log_file '/var/log/messages' option log_type 'file' option log_size '64' option log_r

我尝试远程记录我的OpenWRT系统。为此,我将/etc/config/system设置为:

config system
        option hostname 'MySystem'
        option timezone 'UTC'
        option log_file '/var/log/messages'
        option log_type 'file'
        option log_size '64'
        option log_rotated '10'
        option log_ip '192.168.1.200'
在我的Ubuntu系统上,我尝试接收这些日志消息。已安装syslog ng/etc/syslog ng/syslog-ng.conf如下所示:

@version: 3.5
@include "scl.conf"
@include "`scl-root`/system/tty10.conf"

# First, set some global options.
options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);
          owner("root"); group("adm"); perm(0640); stats_freq(0);
          bad_hostname("^gconfd$");
};

source s_net { udp();  };
destination s_messages { file("/var/log/my_test/remote.log");};
log { source(s_net); destination(s_messages);};
@include "/etc/syslog-ng/conf.d/*.conf"
每当日志消息登录到OpenWRT的/var/log/messages中时,文件就会显示:

Mon Dec 19 15:11:18 2016 daemon.emerg logread[1021]: Logread connected to 192.168.1.200:514                                                                   
Mon Dec 19 15:11:27 2016 local0.info my_service[1348]: My logging message
Mon Dec 19 15:11:27 2016 daemon.emerg logread[1021]: failed to send log data to 192.168.1.200:514 via udp 
有什么问题吗?从OpenWRT Ping到192.168.1.200成功。我想OpenWRT工作正常。问题是syslog ng配置是否正确


谢谢你的帮助

终于成功了。问题出在我的ubuntu系统(防火墙)上。OpenWRT工作得很好。

我刚刚使用了这个问题的
配置系统部分和服务器配置说明,它工作得很好

我用这个内容创建了一个
/etc/rsyslog.d/10 openwrt remote logread.conf
文件(不需要
iptables
):


现在我的树莓上有一个很好的
openwrt.log
文件。

嗨,在你的Ubuntu系统上尝试使用wireshark/tcpdump来检查消息是否到达服务器。但是,由于udp是一个fire-and-forget协议,并且您的openwrt注意到有问题,所以我认为问题出在openwrt方面。(可能是本地防火墙?)你说得对。UDP未被跟踪,因此OpenWRT系统是问题所在。我将更仔细地了解OpenWRT配置。嗨@Farley。你能看看我的openwrt问题吗。无法理解。我甚至可以对所有网络进行同样的日志记录吗
$ModLoad imudp  
$UDPServerRun 514  
:fromhost-ip, isequal, "192.168.0.1" /var/log/openwrt.log  
& ~