重要: McAfeeでは、この目的のために作成された組み込みサーバー タスクを使用して脅威イベントを削除することをお勧めします。 この記事は、組み込みのタスクでは不十分な場合にのみ使用してください。
この記事では、ePO データベースから大量の脅威イベント情報を削除する方法について説明します。 このタスクを実行するには、添付のスクリプト(PurgeThreatEvents.zip)を使用する必要があります。 パージするイベントをターゲットとするようにスクリプトを変更する必要があります。
添付の SQL クエリを使用して、イベントを削除できます。 デフォルトでは、12 か月以上前の
DetectedUTC 時間を持つすべてのイベントを、バッチ間の 5 秒の遅延で 10,000 のバッチでパージします。 テストでは、5 秒の遅延で 10,000 のバッチサイズが適切に機能することが示されています。 ただし、これらの値を環境に合わせて調整する必要がある場合があります。 値を調整するには、添付のスクリプトの次の行を変更して、ニーズを反映します。
--*****EDIT THE NEXT FOUR LINES AS NEEDED *****
declare @BatchSize int = 10000
declare @BatchDelaySeconds int = 5
declare @DeleteTime int = -12
declare @PurgeWhereClause NVARCHAR(MAX) = 'DetectedUTC < DATEADD(MM, @DeleteTime, GETDATE())'
上記の変数の編集に関するガイダンス:
- @BatchSize – バッチサイズが大きいほど、パージが速くなります。 バッチサイズを小さくしても、トランザクション ログは大きくなりません。
- @BatchDelaySeconds – この変数は、スクリプトがバッチ間で一時停止する時間を制御します。 パージ スクリプトの実行中に DB\Events フォルダーに大量のイベント バックログを作成する場合、イベント パーサーがバッチ間のイベントに追いつくように遅延を増やす必要がある場合があります。
- @DeleteTime – 時間でパージする場合、このパラメーターはイベントがパージされる月数を制御します。 デフォルトでは、12 か月以上経過したすべてのイベントが削除されます。
- @PurgeWhereClause – パージするイベントを識別するための SELECT 文を記述します。 SELECT 文の WHERE 句をこの変数の一重引用符の間に貼り付けます。
注: WHERE 句に一重引用符を含める必要がある場合は、クエリがエスケープされないように、2 つの一重引用符を組み合わせる必要があります。
WHERE 句の例:
- EventID 1095 のすべての発生をパージします。
ThreatEventID = 1095
- EventID 1095 および 1092 のすべての発生をパージします:
ThreatEventID IN (1092,1095)
- 365 日(1 年)より前に発生した EventID 1095 および 1092 のすべての発生をパージします(変数 @DeleteTime に 365 を渡します):
ReceivedUTC < DATEADD(dd, @DeleteTime, GETDATE()) AND ThreatEventID IN (1092,1095)
- 365 日(1 年)より前に発生したイベントのすべての発生をパージします (変数 @DeleteTime に 365 を渡します):
ReceivedUTC < DATEADD(dd, @DeleteTime, GETDATE())
必要に応じてスクリプトを変更したら、次の手順で実行します。
- SQL Management Studio を開き、プライマリ ePO データベースに接続します。 この手順の詳細が必要な場合は、 KB67591 を参照してください。
重要: ePO 5.10 を使用している場合は、イベント データベースを指定しない でください。 スクリプトは、プライマリ データベースに対して実行しない限り、正しく機能しません。
- スクリプトのコンテンツをクエリー ウィンドウに貼り付けます。
- [実行]をクリックするか、F5キーを押します。
- ePO サーバーとリモート ハンドラーの \DB\Events フォルダーを監視します。 蓄積するイベントの過剰なバックログがないことを確認します。 その場合は、スクリプトを停止して、バッチサイズを小さくするか、バッチ遅延を大きくする必要があります。
注: パージするイベントの数によっては、スクリプトが完了するまでに数時間または数日かかる場合があります。 ただし、ePO サーバーはスクリプトの実行中も機能し続けます。
SQL エージェント ジョブを使用したスクリプトの自動化
必要に応じて、このスクリプトを自動化して、定期的に実行することができます。
ePO データベースをホストする SQL Server で SQL エージェント ジョブを作成します。
- サービス SQLSERVERAGENT が実行されていることを確認し、自動開始モードに設定します。
- Microsoft SQL Server Management Studio を開き、SQL Server Agent, Jobs に移動します。
- Jobs を右クリックし、 New Job を選択します。
- ジョブの名前を設定してください。 例えば、ePO Events purging などです。
- 左側のペインで Steps をクリックします。
- 「ステップ」ウィンドウで New をクリックします。
- 前のセクションで説明したように、必要に応じて変更した SQL スクリプト (PurgeThreatEvents.zip) を入力します。
- プライマリ ePO データベースが選択されていることを確認します。
- Schedules をクリックし、New をクリックしてスケジュールを作成します。
- スケジュールに名前を付け (例えば、Weekly)、スケジュールを構成します。
- Notifications をクリックします。 このオプションは、エラー報告を有効にします。
- 以下を選択します。
- Windows アプリケーション イベントログへの書き込み
- ジョブが完了したとき
注: オプションを変更して、ジョブが失敗した場合にのみイベントをログに記録できます。
- スケジュールを追加するには、OK をクリックします。