| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
| ja:documentation:pandorafms:technical_annexes:rsyslog-audit-forwarding [2026/07/18 06:01] – [Process description] junichi | ja:documentation:pandorafms:technical_annexes:rsyslog-audit-forwarding [2026/07/18 22:39] (現在) – [Operational review list] junichi |
|---|
| <wrap #ks4 /> | <wrap #ks4 /> |
| |
| ===== Receiver: `rsyslog-receiver` ===== | ===== レシーバー: `rsyslog-receiver` ===== |
| |
| <wrap #ks4_1 /> | <wrap #ks4_1 /> |
| ==== Installing Rsyslog ==== | ==== Rsyslog のインストール ==== |
| |
| In most Rocky Linux installations, Rsyslog is already installed by default. If it is a minimal installation that does not have it, the command to install it is: | In most Rocky Linux installations, Rsyslog is already installed by default. If it is a minimal installation that does not have it, the command to install it is: |
| | |
| | Rocky Linux のほとんどのインストール環境では、Rsyslog はデフォルトですでにインストールされています。インストールされていない最小構成(Minimal Install)の場合、インストールするためのコマンドは以下の通りです。 |
| |
| <code bash> | <code bash> |
| |
| <wrap #ks4_2 /> | <wrap #ks4_2 /> |
| ==== Rsyslog configuration ==== | |
| | ==== Rsyslog 設定 ==== |
| |
| Create ''/etc/rsyslog.d/10-remote-audit.conf'' with the following content: | Create ''/etc/rsyslog.d/10-remote-audit.conf'' with the following content: |
| | |
| | 以下の内容で ''/etc/rsyslog.d/10-remote-audit.conf'' を作成します。 |
| |
| <file | 10-remote-audit.conf> | <file | 10-remote-audit.conf> |
| |
| **What each block does**: | **What each block does**: |
| | |
| | **各ブロックの機能**: |
| |
| * ''module(load="imtcp")'' enables the Syslog receiver over TCP. Use ''imudp'' if UDP is preferred; TCP is recommended for audit data. | * ''module(load="imtcp")'' enables the Syslog receiver over TCP. Use ''imudp'' if UDP is preferred; TCP is recommended for audit data. |
| * ''ruleset("RemoteAudit")'' links the single writer to that file via ''dynaFile='' (see "Known issues" below to understand why ''template='' does not work here in Rsyslog 8.2510). | * ''ruleset("RemoteAudit")'' links the single writer to that file via ''dynaFile='' (see "Known issues" below to understand why ''template='' does not work here in Rsyslog 8.2510). |
| * ''input(type="imtcp" port="10514" ruleset="RemoteAudit")'' opens the listener and routes incoming messages to the custom //ruleset// instead of the default //ruleset//. | * ''input(type="imtcp" port="10514" ruleset="RemoteAudit")'' opens the listener and routes incoming messages to the custom //ruleset// instead of the default //ruleset//. |
| | |
| | * ''module(load="imtcp")'' は、TCP 経由の Syslog 受信機能を有効にします。UDP を使用したい場合は ''imudp'' を使用してください(監査データには TCP が推奨されます)。 |
| | * 文字列(string)型の ''template'' である ''PandoraAudit'' は、出力ファイルのパスを定義します。 |
| | * ''ruleset("RemoteAudit")'' は、''dynaFile='' を介して単一の書き込み処理をそのファイルに紐付けます(Rsyslog 8.2510 において、なぜここで ''template='' が機能しないのかについては、後述の「既知の問題」を参照してください)。 |
| | * ''input(type="imtcp" port="10514" ruleset="RemoteAudit")'' はリスナーを起動し、受信したメッセージをデフォルトの //ruleset// ではなく、カスタム //ruleset// へとルーティングします。 |
| |
| <wrap #ks4_3 /> | <wrap #ks4_3 /> |
| ==== Enable and validate ==== | |
| | ==== 有効化および検証 ==== |
| |
| <code bash> | <code bash> |
| |
| **Expected**: a ''LISTEN'' line on ''0.0.0.0:10514'' and ''[::]:10514''. In production, the receiving //host// must allow incoming ''TCP 10514'' traffic from the sender in its //firewall// (or in the network //firewall// carrying the audit traffic). | **Expected**: a ''LISTEN'' line on ''0.0.0.0:10514'' and ''[::]:10514''. In production, the receiving //host// must allow incoming ''TCP 10514'' traffic from the sender in its //firewall// (or in the network //firewall// carrying the audit traffic). |
| | |
| | **期待される動作**: ''0.0.0.0:10514'' および ''[::]:10514'' での ''LISTEN'' 行の表示。本番環境では、受信側のホストにおいて、送信元からの ''TCP 10514'' トラフィックをファイアウォール(または監査トラフィックを通過させるネットワークファイアウォール)で許可する必要があります。 |
| |
| <wrap #ks5 /> | <wrap #ks5 /> |
| ===== Sender: `pandora-console` ===== | |
| | ===== 送信側: `pandora-console` ===== |
| |
| The Pandora FMS Server already includes Rsyslog (it is installed by default and active in the standard Console image). You only need to add the audit forwarding configuration. | The Pandora FMS Server already includes Rsyslog (it is installed by default and active in the standard Console image). You only need to add the audit forwarding configuration. |
| | |
| | Pandora FMS サーバには、すでに Rsyslog が含まれています(標準のコンソールイメージではデフォルトでインストールされ、有効になっています)。必要な作業は、監査ログ転送の設定を追加することだけです。 |
| |
| <wrap #ks5_1 /> | <wrap #ks5_1 /> |
| ==== Create the forwarding configuration ==== | |
| | ==== 転送設定の作成 ==== |
| |
| Create ''/etc/rsyslog.d/10-pandora-audit-fwd.conf'': | Create ''/etc/rsyslog.d/10-pandora-audit-fwd.conf'': |
| | |
| | ''/etc/rsyslog.d/10-pandora-audit-fwd.conf'' を作成します: |
| |
| <file | 10-pandora-audit-fwd.conf> | <file | 10-pandora-audit-fwd.conf> |
| |
| **Notes on the parameters**: | **Notes on the parameters**: |
| | |
| | **パラメータに関する注記**: |
| |
| * ''action.resumeRetryCount="-1"'' makes the sender retry indefinitely when the receiver is down; this gives the sender the "//buffer// if the network goes down" behavior. | * ''action.resumeRetryCount="-1"'' makes the sender retry indefinitely when the receiver is down; this gives the sender the "//buffer// if the network goes down" behavior. |
| * ''Tag="pandora-audit"'' allows the receiver and //downstream filters// to recognize the //stream//. ''Facility="local0"'' keeps it out of the //standard facilities// (''auth'', ''syslog''). | * ''Tag="pandora-audit"'' allows the receiver and //downstream filters// to recognize the //stream//. ''Facility="local0"'' keeps it out of the //standard facilities// (''auth'', ''syslog''). |
| * ''ruleset="RemoteAuditFwd"'' in the ''imfile'' input is the critical part: It makes the //file-tail// output bypass the main //ruleset// and reach only the ''omfwd'' action. | * ''ruleset="RemoteAuditFwd"'' in the ''imfile'' input is the critical part: It makes the //file-tail// output bypass the main //ruleset// and reach only the ''omfwd'' action. |
| | |
| | * ''action.resumeRetryCount="-1"'' は、受信側がダウンしている場合に送信側が再試行を無期限に続けるように設定します。これにより、送信側は「ネットワークがダウンした際にデータをバッファリングする」という動作を行うようになります。 |
| | * ''queue.type="linkedList"'' は、キューをメモリ上に保持するシンプルな設定です。監査データの量がディスクキューの使用に適した規模であれば、''queue.type="disk"'' に変更してください(注意: ''queue.maxdisksize'' は //ディスク// キューに対してのみ有効です)。 |
| | * ''Tag="pandora-audit"'' を指定することで、受信側や後続のフィルタ(downstream filters)がこのストリームを識別できるようになります。''Facility="local0"'' を指定することで、標準のファシリティ(''auth'' や ''syslog'')とは区別されます。 |
| | * ''imfile'' 入力における ''ruleset="RemoteAuditFwd"'' は重要な設定箇所です。これにより、ファイル末尾の出力(file-tail output)がメインのルールセットをバイパスし、''omfwd'' アクションにのみ渡されるようになります。 |
| |
| <wrap #ks5_2 /> | <wrap #ks5_2 /> |
| ==== Validate the configuration and start the service ==== | |
| | ==== 設定の検証とサービスの開始 ==== |
| |
| <code bash> | <code bash> |
| |
| ''rsyslogd -N1'' performs a validation pass in a single read. | ''rsyslogd -N1'' performs a validation pass in a single read. |
| | |
| | ''rsyslogd -N1'' は、1回の読み取りで検証パスを実行します。 |
| |
| The expected last line is ''End of config validation run. Bye.'' //Anything else | The expected last line is ''End of config validation run. Bye.'' //Anything else |
| indicates the configuration does not load, and the service will run **without** the forwarding | indicates the configuration does not load, and the service will run **without** the forwarding |
| rules//. | rules//. |
| | |
| | 期待される最後の行は ''End of config validation run. Bye.'' です。//それ以外の出力は、設定が読み込まれなかったことを示しており、その場合、サービスは転送ルールを適用せずに動作します//。 |
| |
| <wrap #ks6 /> | <wrap #ks6 /> |
| ===== Testing and debugging ===== | |
| | ===== テストとデバッグ ===== |
| |
| <wrap #ks6_1 /> | <wrap #ks6_1 /> |
| ==== Smoke test ==== | |
| | ==== スモークテスト ==== |
| |
| <code bash> | <code bash> |
| Expected output (the //timestamp// and the program name are added by Rsyslog on | Expected output (the //timestamp// and the program name are added by Rsyslog on |
| the sender; the final part is the original line): | the sender; the final part is the original line): |
| | |
| | 期待される出力(//timestamp// とプログラム名は送信側の Rsyslog によって付加され、末尾部分は元の行です): |
| |
| <file> | <file> |
| |
| In production, the audit lines are written by the Console itself, which does not need to "know" anything about Rsyslog. | In production, the audit lines are written by the Console itself, which does not need to "know" anything about Rsyslog. |
| | |
| | 本番環境では、監査ログの行はコンソール自身によって書き込まれるため、コンソールが Rsyslog について何かを「知る」必要はありません。 |
| |
| <wrap #ks6_2 /> | <wrap #ks6_2 /> |
| ==== Connectivity check ==== | |
| | ==== 接続チェック ==== |
| |
| If nothing reaches the receiver, first validate the network path: | If nothing reaches the receiver, first validate the network path: |
| | |
| | 受信側に何も届かない場合は、まずネットワーク経路を検証してください。 |
| |
| <code bash> | <code bash> |
| |
| This works without ''nc'' or ''ncat'' and is the fastest way to rule out //firewall///network issues. | This works without ''nc'' or ''ncat'' and is the fastest way to rule out //firewall///network issues. |
| | |
| | これは ''nc'' や ''ncat'' を使わずに動作し、ファイアウォールやネットワークの問題を切り分けるための最も迅速な方法です。 |
| |
| <wrap #ks6_3 /> | <wrap #ks6_3 /> |
| ==== Review Rsyslog journals ==== | |
| | ==== Rsyslog ジャーナルの確認 ==== |
| |
| Each of the endpoints has detailed error reports in its Systemd unit: | Each of the endpoints has detailed error reports in its Systemd unit: |
| | |
| | 各エンドポイントの Systemd ユニットには、詳細なエラーレポートが含まれています。 |
| |
| <code bash> | <code bash> |
| |
| **Patterns worth recognizing**: | **Patterns worth recognizing**: |
| | |
| | **認識しておくべきパターン**: |
| |
| * ''action 'action-0-builtin:omfwd' suspended (…)'' followed by ''resumed'' — the receiver has gone down (or has been restarted), and the sender has reconnected. Messages are not lost thanks to ''action.resumeRetryCount=-1'' and ''queue.saveonshutdown=on''. \\ | * ''action 'action-0-builtin:omfwd' suspended (…)'' followed by ''resumed'' — the receiver has gone down (or has been restarted), and the sender has reconnected. Messages are not lost thanks to ''action.resumeRetryCount=-1'' and ''queue.saveonshutdown=on''. \\ |
| * ''omfwd: remote server closed connection'' — the receiver is rejecting connections. Check that the //listener// is running and that the //ruleset// is free of //parsing// errors. \\ | * ''omfwd: remote server closed connection'' — the receiver is rejecting connections. Check that the //listener// is running and that the //ruleset// is free of //parsing// errors. \\ |
| * ''error during parsing file /etc/rsyslog.d/*.conf, on or before line N'' — correct the configuration and run ''rsyslogd -N1'' again before restarting the service. \\ | * ''error during parsing file /etc/rsyslog.d/*.conf, on or before line N'' — correct the configuration and run ''rsyslogd -N1'' again before restarting the service. \\ |
| | |
| | * ''action 'action-0-builtin:omfwd' suspended (…)'' に続いて ''resumed'' と表示される — 受信側が停止(または再起動)し、送信側が再接続したことを示します。''action.resumeRetryCount=-1'' および ''queue.saveonshutdown=on'' の設定により、メッセージが失われることはありません。 \\ |
| | * ''omfwd: remote server closed connection'' — 受信側が接続を拒否しています。//リスナー//(listener)が動作していること、および //ルールセット//(ruleset)に //パース//(parsing)エラーがないことを確認してください。 \\ |
| | * ''error during parsing file /etc/rsyslog.d/*.conf, on or before line N'' — 設定を修正し、サービスを再起動する前に再度 ''rsyslogd -N1'' を実行してください。 \\ |
| |
| <wrap #ks6_4 /> | <wrap #ks6_4 /> |
| ==== Common issues and solutions ==== | |
| | ==== よくある問題と解決策 ==== |
| |
| ^Symptom ^Root cause ^Solution ^ | ^Symptom ^Root cause ^Solution ^ |
| |New audit lines arrive with a delay.|''imfile'' does //polling// every 10 seconds by default.| Lower that value with ''PollingInterval="2"'' in the ''imfile'' input if near-//real-time// is needed.| | |New audit lines arrive with a delay.|''imfile'' does //polling// every 10 seconds by default.| Lower that value with ''PollingInterval="2"'' in the ''imfile'' input if near-//real-time// is needed.| |
| |After a sender restart, the last seconds of auditing are lost| The memory queue is discarded upon shutdown.|''queue.saveonshutdown="on"'' (specified in the [[#ks6_3|Rsyslog journals review]]) persists the queue to disk; upon startup, Rsyslog empties it.| | |After a sender restart, the last seconds of auditing are lost| The memory queue is discarded upon shutdown.|''queue.saveonshutdown="on"'' (specified in the [[#ks6_3|Rsyslog journals review]]) persists the queue to disk; upon startup, Rsyslog empties it.| |
| | |
| | ^症状 ^根本原因 ^解決策 ^ |
| | |受信側が空のままで、送信側のログに ''remote server closed connection'' と記録される。|受信側の設定に //解析 (parsing)// エラーがある。//リスナー (listener)// は動作しているが、メッセージがデフォルトの //ルールセット (ruleset)// によって破棄されている。|受信側で ''rsyslogd -N1'' を実行し、設定を修正する。Rsyslog 8.2510 以降では、''omfile'' 内で ''template='' ではなく ''dynaFile='' を使用する。| |
| | |受信側のファイルは存在するが、監査ログだけでなく ''CROND'' や ''rsyslogd'' などのログも含まれている。|送信側の //設定 (config)// のルートレベルで ''omfwd'' アクションが宣言されており、//メインルールセット (main ruleset)// からのすべてのメッセージが転送されている。|''omfwd'' アクションを専用の //ルールセット (ruleset)// で囲み、''ruleset="..."'' を使用して ''imfile'' 入力をそのルールセットにリンクさせる。| |
| | |送信側で ''parameter 'queue.maxdisksize' not known'' というエラーが出る。|そのパラメータは ''queue.type="disk"'' の場合にのみ有効であり、''linkedList'' では無効である。|''queue.maxdisksize'' を削除するか、キューを ''disk'' に変更する。| |
| | |''/var/lib/rsyslog/imfile-state*'' を削除した後、過去のデータが転送されない。|期待される動作: //状態ファイル (state file)// がない場合、''imfile'' はファイルの現在の末尾を起点とし、新しい行のみを送信する。|//状態ファイル (state file)// はそのままにしておく。**過去のデータを転送するには**、''imfile'' 入力で ''readMode="2"'' を使用する。| |
| | |新しい監査ログの行が遅れて到着する。|''imfile'' はデフォルトで 10 秒ごとに //ポーリング (polling)// を行う。|ほぼ //リアルタイム (real-time)// の処理が必要な場合は、''imfile'' 入力で ''PollingInterval="2"'' を指定してその値を小さくする。| |
| | |送信側を再起動した後、最後の数秒間の監査ログが失われる。|シャットダウン時にメモリキューが破棄されるため。|''queue.saveonshutdown="on"''([[#ks6_3|Rsyslog ジャーナルの確認]] で指定)を設定すると、キューがディスクに保存される(起動時に Rsyslog がそれを処理して空にする)。| |
| |
| <wrap #ks6_5 /> | <wrap #ks6_5 /> |
| ==== Re-anchoring the sender ==== | |
| | ==== 送信側のアンカー再設定 ==== |
| |
| To rebuild the audit //stream// from scratch (for example, after a long offline period for the receiver where the local audit //log// has fallen behind), reset the ''imfile'' //state// and confirm that the file still exists in the expected path: | To rebuild the audit //stream// from scratch (for example, after a long offline period for the receiver where the local audit //log// has fallen behind), reset the ''imfile'' //state// and confirm that the file still exists in the expected path: |
| | |
| | 監査ストリームをゼロから再構築する場合(例えば、受信側が長期間オフラインになり、ローカルの監査ログの処理が遅延してしまった後など)、''imfile'' の状態(state)をリセットし、対象のファイルが想定されるパスに存在することを確認してください。 |
| |
| <code bash> | <code bash> |
| |
| After the restart, the sender only sends the lines written **after** the restart. To forward everything from the beginning of the current ''audit.log'', add ''readMode="2"'' to the ''imfile'' input and restart Rsyslog again. | After the restart, the sender only sends the lines written **after** the restart. To forward everything from the beginning of the current ''audit.log'', add ''readMode="2"'' to the ''imfile'' input and restart Rsyslog again. |
| | |
| | 再起動後、送信側は再起動**以降**に書き込まれた行のみを送信します。現在の ''audit.log'' の冒頭からすべてを転送するには、''imfile'' 入力に ''readMode="2"'' を追加し、Rsyslog を再度再起動します。 |
| |
| <wrap #ks7 /> | <wrap #ks7 /> |
| ===== Operational review list ===== | |
| | ===== 作業確認リスト ===== |
| |
| * □ The receiver is online from the sender via ''TCP 10514''. | * □ The receiver is online from the sender via ''TCP 10514''. |
| * □ The receiver's //log// file contains **only** lines with the ''pandora-audit'' //tag// (without ''CROND'' / ''rsyslogd''). | * □ The receiver's //log// file contains **only** lines with the ''pandora-audit'' //tag// (without ''CROND'' / ''rsyslogd''). |
| * □ ''systemctl enable rsyslog'' applied on both //hosts// so that forwarding survives a restart. | * □ ''systemctl enable rsyslog'' applied on both //hosts// so that forwarding survives a restart. |
| | |
| | * □ 送信元から受信側へ ''TCP 10514'' で接続可能である。 |
| | * □ 両端で ''rsyslogd -N1'' を実行し、設定に問題がないことを確認済みである。 |
| | * □ 受信側で ''ss -ltn | grep 10514'' を実行すると、''LISTEN'' 状態であることが確認できる。 |
| | * □ ''audit.log'' に追加したテスト行が、ポーリング間隔以内に ''/var/log/received/pandora-audit.log'' へ反映される。 |
| | * □ 受信側のログファイルには、''pandora-audit'' タグが付いた行**のみ**が含まれている(''CROND'' や ''rsyslogd'' などの行は含まれない)。 |
| | * □ 再起動後も転送が継続されるよう、両ホストで ''systemctl enable rsyslog'' が実行されている。 |
| |
| [[ja:documentation:pandorafms:start|Pandora FMS ドキュメント一覧に戻る]] | [[ja:documentation:pandorafms:start|Pandora FMS ドキュメント一覧に戻る]] |
| |