Syslog メモ

2023/07/15

Linux (CentOS系)

デフォで Syslog 使用なので rsyslog なりの設定を見る。

# vi /etc/rsyslog.conf


## 略

# Log all the mail messages in one place.

mail.*                                                  -/var/log/maillog
mail.*                                                  @192.0.2.1:514

ローカルと Syslog サーバの2ヶ所にメールログを蓄積する場合。

# systemctl restart rsyslog

一応再起動で。

# vi /etc/httpd/conf/httpd.conf


#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
## ErrorLog logs/error_log
ErrorLog  "|/usr/bin/logger -p local6.info -t httpd_error"


#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
## CustomLog logs/access_log combined
CustomLog "|/usr/bin/logger -p local5.info -t httpd_access" combined

Apache も見たいので設定。ただし Apache はデフォルトでは Syslog を使わないので Apache の設定も編集が必要。

# vi /etc/rsyslog.conf


# Log all the apache messages in one place.
local5.* /var/log/httpd/access_log
local5.*                                                @192.0.2.1:514
local6.* /var/log/httpd/error_log
local6.*

facility を local5, local6 を使って設定。メールと同様ローカルと Syslog サーバの2箇所に蓄積するようにする。

# systemctl restart rsyslog
#

# systemctl reload httpd
#

Apache, rsyslog を再起動or設定再読み込み。これでOK。

Windows

Windows には標準でSyslogに転送する機能はないらしい。そのためサードパーティ製ソフトウェアを使用するしかなさそう。

いくつかネットに落ちてた設定のうち

ここの設定で上手く行った。中身までは精査していない。バージョンは nxlog-ce-3.2.2329


Written by Circle
A mound built by the accumulation of hyperlinks are like Kowloon.