#author("2020-05-20T08:06:48+09:00","default:tanak0to","tanak0to") #author("2020-06-11T16:03:45+09:00","default:tanak0to","tanak0to") RIGHT:[[Linux 関係覚え書き]] RHEL8 の rsyslog で syslog サーバを作る *ファイルディスクリプタ [#p81c73e7] たくさんのログファイルを開くため,ディスクリプタを増やしておく. 次のようなファイルを作成する # vi /etc/systemd/system/rsyslog.service.d/limit_nofile_limit.conf [Service] LimitNOFILE=16384 RHEL8 では,元々 16384 になっているようだ. # cat /proc/`pidof rsyslog`/limits | grep -i "max open files" *設定方針 [#b54983c4] -リモートサーバ,ネットワーク機器から syslog を受け取る. -ログは送信した機器ごとに以下の名前で保存する. ホスト名/年/月/ホスト名_年月日.log -ログのフォーマットは以下とする. 時間 ホスト名 ログレベル ファシリティ タグ ログ本文 -Warnning 以上(5 より小)のレベルのログを出力する. -localhost のログは,通常通りの出力,ファイルとする. *設定 [#rc4c7912] /etc/rsyslog #### GLOBAL DIRECTIVES #### module(load="imudp") # needs to be done just once input(type="imudp" port="514") module(load="imtcp") # needs to be done just once input(type="imtcp" port="514") #### TEMPLATE ##### template(name="VERBOSE" type="list"){ property(name="timestamp") constant(value=" ") property(name="hostname") constant(value=" ") property(name="syslogseverity-text") constant(value=" ") property(name="syslogfacility-text") constant(value=" ") property(name="syslogtag") property(name="msg" spifno1stsp="on") property(name="msg" droplastlf="on") constant(value="\n") } template(name="FWlog" type="string" string="/Log/%hostname%/%$year%/%$month%/%hostname%_%$year%%$month%%$day%.log" ) #### RULES #### if ( $hostname != "localhost" and $syslogseverity < '5') then { action(type="omfile" DynaFile="FWlog" template="VERBOSE") stop } ---- *Windows のイベントログ [#aba1c705] Windows のイベントログを syslog サーバに飛ばすには NXlog を使う. 参考: https://jtc-networkmanagementmaster.blogspot.com/2018/12/nls-realtime-log-monitoring-05.html