Closed tkhr-ueda closed 5 months ago
ログ集約処理の実行直後に、新たなログファイルが生成(ローテート)され、その後rmコマンドが実行された場合にログの欠損が生じる可能性がある。
https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/bro.sh#L17-L18 https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/p0f.sh#L4-L6 https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/suricata.sh#L5-L6 https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/yaf.sh#L3-L19
集約対象のログファイルのリストを変数に格納した後、集約処理や削除処理を実行する際に当該変数を参照する。
問題点
ログ集約処理の実行直後に、新たなログファイルが生成(ローテート)され、その後rmコマンドが実行された場合にログの欠損が生じる可能性がある。
該当する処理
https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/bro.sh#L17-L18 https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/p0f.sh#L4-L6 https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/suricata.sh#L5-L6 https://github.com/nttcom/OsecT/blob/6604b9bfc42d7e056cbfc99f5a0acdc4498cbe7e/osect_sensor/Infrastructure/edge_cron/work/ot_tools/yaf.sh#L3-L19
解決方針
集約対象のログファイルのリストを変数に格納した後、集約処理や削除処理を実行する際に当該変数を参照する。