ネットワーク機器等からのsyslogを受信

サーバ側の設定

受信の設定
1.vi /etc/rc.d/init.d/syslog

# Source config
if [ -f /etc/sysconfig/syslog ] ; then
   . /etc/sysconfig/syslog
else
    SYSLOGD_OPTIONS=”-m 0″

# Source config
if [ -f /etc/sysconfig/syslog ] ; then
   . /etc/sysconfig/syslog
else
    SYSLOGD_OPTIONS=”-m 0 -r

必ず-r-m 0の後。

2.vi /etc/sysconfig/syslog

# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
    SYSLOGD_OPTIONS=”-m 0 -r”

# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
    SYSLOGD_OPTIONS=”-m 0 -r

必ず-r-m 0の後。

3.再起動

# /etc/rc.d/init.d/syslog restart
カーネルロガーを停止中: [ OK ]
システムロガーを停止中: [ OK ]
システムロガーを起動中: [ OK ]
カーネルロガーを起動中: [ OK ]

当然ながら、syslogを受信するポート(通常は514/udp)を開放しないと、受信はできない。



機器毎にログファイルを作成する場合

1.vi /etc/syslog.conf

#コメント。機器ホスト名を入れるとわかりやすい
機器に設定したファシリティ.*                          ログを保存する場所

以上を最終行に追加する。

# IX2015
local1.*                          /var/log/router/ix2015.log



ログをローティションする場合
1.vi /etc/logrotate.d/syslog

/var/log/messages /var/log/secure /var/log/maillog /var/log/cron {
sharedscripts
postrotate

/var/log/messages /var/log/secure /var/log/maillog /var/log/cron 追加した受信ログファイル {
sharedscripts
postrotate

シェアする

  • このエントリーをはてなブックマークに追加

フォローする