我在 ubuntu 服务器上安装了 rsyslogd,启动它,一切看起来都很好,但是服务器应该监听的端口没有打开。
ubuntu@node7:~$ sudo service rsyslog restart
rsyslog stop/waiting
rsyslog start/running, process 14114
Netstat 显示它没有在监听:
ubuntu@node7:~$ netstat -tlan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 320 172.22.0.17:22 10.8.8.38:61335 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::2776 :::* LISTEN
tcp6 0 0 :::2777 :::* LISTEN
tcp6 0 0 172.22.0.17:2777 172.22.0.11:56554 ESTABLISHED
tcp6 0 0 172.22.0.17:2776 172.22.0.11:39780 ESTABLISHED
这是 /etc/rsyslog.conf 的样子(省略了大部分注释):
ubuntu@node7:~$ cat /etc/rsyslog.conf
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
$ModLoad imtcp
$InputTCPServerRun 514
###########################
#### GLOBAL DIRECTIVES ####
###########################
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$RepeatedMsgReduction on
$WorkDirectory /var/spool/rsyslog
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup adm
$IncludeConfig /etc/rsyslog.d/*.conf
在/etc/rsyslog.d/35-server-per-host.conf
我有以下几行,我怀疑这可能是原因。这是什么意思?
# Stop processing of all non-local messages. You can process remote messages
# on levels less than 35.
:fromhost-ip,!isequal,"127.0.0.1" ~
如果是,我如何更改它以让服务器侦听、接收和记录消息?
更新:
我注释掉了可疑的行,但它仍然没有在端口 514 上监听