DEV Community

Cover image for CloudWatch LogsでWindows Defenderのログを収集する
ryanc
ryanc

Posted on • Edited on

3 3

CloudWatch LogsでWindows Defenderのログを収集する

Amazon CloudWatch LogsにCloudWatch統合エージェントをインストールしてイベントログを収集する方法は、公式ドキュメントやその他ブログ記事もたくさんあり、そのまま従えば良いのだが、一番よくあるSystem、Application、Securityのログ以外にちょっとマニアックなもの(今回はWindows Defender)のイベントログをとるには、エージェントのconfigはどう書けばいいのか質問を受けたことがある。

まあ色々試せば誰でも発見できると思うが、あまり記事も見かけないし忙しい人達が自分で試す手間も減らしたいので、共有しようと思う。



configに使うevent_nameが、SystemやSecurityだとそれぞれそのまま記載すればいいのだが、それ以外のマイナーなイベントログだと何を指定するか知る必要がある。その確認方法は下記の通り。



Windows Serverで、compmgmt.mscを実行し、イベントビューアを展開する。
image



Windows Defenderのログは、Applications and Services Logs → Microsoft → Windows配下にある。
image



あった。
image



右側のペインのOperationalを右クリックし、プロパティを表示する。基本的にこのOperationalログが必要なもののようだ。
image



プロパティウィンドウで表示されているFull Nameが、必要なevent_nameに相当するので、これをコピーする。この場合はMicrosoft-Windows-Windows Defender/Operationalだった。

つまり、CloudWatchのconfigの中でこのイベントログの拾い方の定義は下記のように記述すれば良い。

{
"event_format": "xml",
"event_levels": [
"INFORMATION",
"WARNING",
"ERROR",
"CRITICAL"
],
"event_name": "Microsoft-Windows-Windows Defender/Operational",
"log_group_name": "WindowsDefender",
"log_stream_name": "{instance_id}"
},
Enter fullscreen mode Exit fullscreen mode



例えばEvent ID 5007でフィルターしたい、という場合はCloudWatch Logsのフィルターパターンで下記のようにパターン定義すれば良いということになる。
image



問題なくWindows DefenderのログがCloudWatch Logsに連携されていることを確認した。
image



こんな感じで、どんなWindowsイベントログでもCloudWatchに連携できるはず!

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more