两个服务器上的相同rsyslog配置,不同的输出

时间:2015-07-06 17:07:42

标签: rsyslog

我开始使用rsyslog将日志文件数据发送到远程服务器。

我有一个开发(server1)和生产(server2)。两个系统都使用相同版本的CentOS和rsyslog。 rsyslog.conf和httpd配置文件完全相同(保存上面的服务器名称)。

问题是其中一个系统正在将自己的IP添加到rsyslog流中,另一个系统没有。在下面的日志数据中,我的本地IP是1.2.3.4,服务器IP是在99.99.99.X子网中。

server1 - CentOS 6.5(开发,99.99.99.77)

Name        : rsyslog
Arch        : x86_64
Version     : 5.8.10
Release     : 10.el6_6

httpd conf:

ErrorLog“| tee -a / var / log / httpd / error_log | logger -thttpd_server1_ssl_error -plocal6.err”

CustomLog“| tee -a / var / log / httpd / access_log | logger -thttpd_server1_ssl_access -plocal5.notice”combined

rsyslog输出: 请注意,仅包含远程IP ...

消息:7月6日11:57:24 server1 httpd_access: 1.2.3.4 - [06 / Jul / 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_6

httpd conf:

ErrorLog“| tee -a / var / log / httpd / error_log | logger -thttpd_server2_ssl_error -plocal6.err”

CustomLog“| tee -a / var / log / httpd / access_log | logger -thttpd_server2_ssl_access -plocal5.notice”combined

rsyslog输出: 请注意,远程服务器IP和服务器IP都包括在内......

消息:7月6日11:58:49 server2 httpd_access: 1.2.3.4 99.99.99.99 - [06 / Jul / 2015:11:58:49 -0400]“GET {{3 HTTP / 1.1“200 443 20

1 个答案:

答案 0 :(得分:0)

问题是两台服务器之间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)。

相关问题