我开始用rsyslog将日志文件数据发送到远程服务器。
我有一个开发(server1)和产品(server2)。这两个系统都使用相同版本的CentOS和rsyslog。rsyslog.conf和httpd配置文件是相同的(保存上面的服务器名称)。
问题是,其中一个系统正在将自己的IP添加到rsyslog流中,而另一个系统则没有。在下面的日志数据中,我的本地IP为1.2.3.4,服务器IP位于99.99.99.X子网中。
server1 - CentOS 6.5 (dev,99.99.99.77)
Name : rsyslog
Arch : x86_64
Version : 5.8.10
Release : 10.el6_6httpd conf:
ErrorLog“-a /var/log/httpd/error_log \ logger -thttpd_server1_ssl_error -plocal6.err”
CustomLog“-a /var/log/httpd/access_log \ logger -thttpd_server1_ssl_access -plocal5.notice”组合
rsyslog输出:注意到只包含远程IP .
Msg: 7月6:57:24 server1 httpd_access:1.2.3.4 -06/7/2015:11:57:23 -0400 "GET /somepage.html HTTP/1.1“200 - "https://server1.top.level.domain/”text/html“Mozilla/5.0 (X11;Ubuntu;Linux x86_64;rv:38.0) Gecko/20100101 Firefox/38.0”
server2 - CentOS 6.5 (prod,99.99.99.99)
Name : rsyslog
Arch : x86_64
Version : 5.8.10
Release : 10.el6_6httpd conf:
ErrorLog“-a /var/log/httpd/error_log \ logger -thttpd_server2_ssl_error -plocal6.err”
CustomLog“-a /var/log/httpd/access_log \ logger -thttpd_server2_ssl_access -plocal5.notice”组合
rsyslog输出:注意:包括远程和服务器IP .
Msg: 7月6日11:58:49 server2 httpd_access:1.2.3.4 99.99.99.99 - 06/ Jul /2015:11:58:49 -0400 "GET https://server1.top.level.domain/ HTTP/1.1“200 443 20
发布于 2015-07-06 20:09:51
问题是两个服务器之间的LogFormat文件在httpd.conf文件中的差异。
在server2上,我改变了
LogFormat "%h %A %l %u %t \"%r\" %>s %p %b" combined至
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{Content-Type}o\" \"%{User-Agent}i\"" combined这与server1上的内容相匹配。
然后我重新启动了apache,现在有了来自这两个服务器的相同的rsyslog数据流(这意味着我只是看到远程用户IP,而不是出站日志数据中的远程和服务器IP )。
https://stackoverflow.com/questions/31251690
复制相似问题