Amazon FSx for NetApp ONTAPの管理アクティビティの監査ログを確認してみた

監査ログから誰がいつ操作したのか簡単に確認できるよ
2022.11.07

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

自分がどんな操作したか確認したいな

こんにちは、のんピ(@non____97)です。

皆さんはAmazon FSx for NetApp ONTAP(以降FSx for ONTAP)に対してどんな操作をしたか確認したいなと思ったことはありますか? 私はあります。

FSx for ONTAPの操作方法は大きく4種類あります。

  1. AWSマネジメントコンソール
  2. AWS CLI / API
  3. NetApp Cloud Manager
  4. ONTAP CLI /API

マネジメントコンソールやAWS CLIによる操作はCloudTrailに記録されますが、NetApp Cloud ManagerやONTAP CLIによる操作はAWSのAPIを経由していないため、記録されません。

FSx for ONTAP上でいつ、どんな操作をしたのか後追いできないのは困ります。

NetApp公式ドキュメントを調べてみるとONTAPの機能として、クラスタで実行された管理アクティビティについて、リクエスト、リクエストしたユーザ、ユーザのアクセス方法、リクエストされた時間などの情報が取得されるようです。

これはありがたいですね。

早速確認してみたので、紹介します。

いきなりまとめ

  • FSx for ONTAPに対するSETリクエストとONTAP REST APIのGETリクエストが管理アクティビティとして監査ログに記録される
    • ONTAP CLIのGETリクエストを記録することは2022/11/6時点ではできない
  • 監査ログの設定は特に不要
    • 何もしなくても記録される
  • 監査ログのローテーションは1日1回もしくは、サイズが100MBを超えた場合に行われ、48世代保持される
  • 出力されたログは外部に転送可能
    • 2022/11/6現在、直接CloudWatch Logsに転送することはできない
    • 2022/11/6現在、転送先はFSx for ONTAPファイルシステムがあるサブネットと同じサブネットに存在する必要がある

管理アクティビティの監査ログの仕様を確認

まず、管理アクティビティの監査ログの仕様を確認します。

取得されるログの種類はSETリクエストとGETリクエストの2種類があるようです。

  • SET requests, which typically apply to non-display commands or operations
    • These requests are issued when you run a create, modify, or delete command, for instance.
    • Set requests are logged by default.
  • GET requests, which retrieve information and display it in the management interface
    • These requests are issued when you run a show command, for instance.
    • GET requests are not logged by default, but you can control whether GET requests sent from the ONTAP CLI (-cliget) or from the ONTAP APIs (-ontapiget) are logged in the file.

How ONTAP implements audit logging

SETリクエストはデフォルトでログファイルに記録され、GETリクエストはデフォルトではログファイルに記録されないのがポイントですね。GETリクエストを有効化する場合は、-cligetもしくは-ontapigetsecurity audit modifyonにするようです。

ログはノードの/mroot/etc/log/mlog/audit.logに出力されるようです。また、ログは以下の4つの方法で操作した際のログが記録されるようです。

  1. クラスタシェル
  2. ノードシェル
  3. 非対話型システムシェル
  4. API

CLI コマンドの 3 つのシェル(クラスタシェル、ノードシェル、および非対話型システムシェル)からのコマンドに加え、 API コマンドがここに記録されます(対話型システムシェルのコマンドは記録されません)。監査ログには、クラスタ内のすべてのノードの時刻が同期しているかどうかを示すタイムスタンプが含まれています。

ONTAP での監査ログの実装方法

ここでクラスタシェルやノードシェル、非対話システムシェルなど聞き馴染みのない単語が出てきました。

調べてみると以下のように紹介されていました。普段使用するのはクラスタシェルのようですね。

  • クラスタシェルは、クラスタにログインすると自動的に開始されるネイティブ シェルです。
    • クラスタシェルには、クラスタの設定と管理に必要なすべてのコマンドが含まれています。クラスタシェルのCLIヘルプ(クラスタシェルのプロンプトで「?」 を入力するとトリガーされる)には、使用可能なクラスタシェル コマンドが表示されます。クラスタシェルのman command_nameコマンドは、指定されたクラスタシェル コマンドのマニュアル ページを表示します。
  • ノードシェルは、ノード レベルでのみ有効なコマンドのための特別なシェルです。
    • ノードシェルには、system node runコマンドを使用してアクセスできます。
    • ノードシェルのCLIヘルプ(ノードシェルのプロンプトで「?」 またはhelpと入力するとトリガーされる)には、使用可能なノードシェル コマンドが表示されます。ノードシェルのman command_nameコマンドは、指定されたノードシェル コマンドのマニュアル ページを表示します。
    • よく使用されるノードシェル コマンドとオプションの多くは、クラスタシェルにトンネリングまたはエイリアスされ、クラスタシェルから実行することもできます。
  • システムシェルは、診断とトラブルシューティングの目的に限って使用する低レベルのシェルです。
    • システムシェルおよび関連する「diag」アカウントは、下位レベルの診断用です。アクセスにはdiagnostic権限が必要で、テクニカル サポートがトラブルシューティング タスクを実行するために予約されています。

CLIコマンド用のシェルの種類について(クラスタ管理者のみ)

ログに記録される内容は以下の通りです。

項目 説明
time. ログエントリのタイムスタンプ
node クラスタに接続しているアプリケーション
取りうる値: internal, console, ssh, http, ontapi, snmp, rsh, telnet, service-processor
entry ログメッセージ
session-id リクエストをしたセッションのID
command-id CLIセッションの各コマンドのID
application クラスタへの接続に使用するアプリケーション
取りうる値: internal, console, ssh, http, ontapi, snmp, rsh, telnet, service-processor
location リモート IP アドレスまたはリモートアクセスポイント
vserver SVM
username リモートユーザのユーザ名
input 試行中の操作
state 監査リクエストの現在の状態
取りうる値: success, pending, error
message コマンドのステータスに関するエラーまたは追加情報 を含むオプションのフィールド

参考 : security audit log show

ログのローテーションは1日1回もしくは、サイズが100MBを超えた場合に行われ48世代保持されるようです。

「 audit.log 」ファイルは、毎日ローテーションされます。また、サイズが 100MB に達したときにもローテーションが実行されます。以前の 48 個のコピーは保持されます(最大合計 49 個のファイル)。監査ファイルが 1 日単位のローテーションを実行するときは、 EMS メッセージは生成されません。監査ファイルのサイズが上限を超えたためにローテーションが実行された場合は、 EMS メッセージが生成されます。

ONTAP での監査ログの実装方法

100MB超えたことによるログローテーションが行われる際にはEMS(Event Management System)メッセージが記録されます。EMSのイベントのログはevent log showで確認するようです。

出力されたログはsyslogサーバなど外部に転送できます。ログをsyslogサーバに転送して、CloudWatch Logsにさらに転送するといったこともできそうですね。

「 audit.log 」ファイルは、 AutoSupport ツールによって指定された受信者に送信されます。また、 Splunk や syslog サーバなど、指定した外部の送信先にコンテンツを安全に転送することもできます。

ONTAP での監査ログの実装方法

管理アクティビティの監査ログ確認してみた

実際に管理アクティビティの監査ログを確認してみましょう。

まず、 管理アクティビティの監査ログの設定と発生したイベントを確認します。

# FSx for ONTAPファイルシステムにSSHで接続
$ ssh fsxadmin@management.fs-037b8b564fe46f4f4.fsx.us-east-1.amazonaws.com
The authenticity of host 'management.fs-037b8b564fe46f4f4.fsx.us-east-1.amazonaws.com (10.0.1.121)' can't be established.
ECDSA key fingerprint is SHA256:IkTC5l8+X2Bq87+kbOyaOoMh0JprBXmYe7mWdeUovk0.
ECDSA key fingerprint is MD5:8e:b5:a8:2d:dd:e7:71:41:02:d0:ef:ff:6f:b0:68:e9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'management.fs-037b8b564fe46f4f4.fsx.us-east-1.amazonaws.com,10.0.1.121' (ECDSA) to the list of known hosts.
Password:

This is your first recorded login.

# 管理アクティビティの監査ログの設定を確認
FsxId037b8b564fe46f4f4::> security audit show

Error: "show" is not a recognized command

# 管理アクティビティの監査ログの設定を変更するコマンドを実行できるか確認
FsxId037b8b564fe46f4f4::> security audit modify

Error: "modify" is not a recognized command

# イベントのログを確認
FsxId037b8b564fe46f4f4::> event log show

Error: "log" is not a recognized command

# イベントのステータスを確認
FsxId037b8b564fe46f4f4::> event status show

Error: "status" is not a recognized command

# 権限を変更して、再チャレンジ
FsxId037b8b564fe46f4f4::> set advanced

Warning: These advanced commands are potentially dangerous; use them only when directed to do so by NetApp personnel.
Do you want to continue? {y|n}: y

FsxId037b8b564fe46f4f4::*> security audit show

Error: "show" is not a recognized command

FsxId037b8b564fe46f4f4::*> security audit modify

Error: "modify" is not a recognized command

FsxId037b8b564fe46f4f4::*> event log show

Error: "log" is not a recognized command

# 権限をもとに戻す
FsxId037b8b564fe46f4f4::*> set admin

security audit showsecurity audit modify はFSx for ONTAPでは実行できないようです。そのため、GETリクエストを記録するように設定することはもちろん、記録するように設定されているか確認することもできません。

また、event log showevent status showどちらも実行できないので、どのようなイベントが発生したのか確認することはできないようです。

気を取り直して、監査ログを確認します。

FsxId037b8b564fe46f4f4::> security audit log show
Time                      Node         Audit Message
------------------------  -----------  -----------------------
Sun Nov 06 05:28:20 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:686] mlogd: started
Sun Nov 06 05:28:21 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:686] mlogd: started
Sun Nov 06 05:30:03 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:657] mlogd: started
Sun Nov 06 05:30:03 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:657] mlogd: started
Sun Nov 06 05:32:03 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:03 +00:00"}
Sun Nov 06 05:32:04 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:04 +00:00"}
Sun Nov 06 05:33:12 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35968 :: Default:admin :: <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp> :: Pending:
Sun Nov 06 05:33:12 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35968 :: Default:admin :: security-login-modify-password :: Success:
Sun Nov 06 05:33:12 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35210 :: Default:admin :: <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp> :: Pending:
Sun Nov 06 05:33:12 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35210 :: Default:admin :: security-login-modify-password :: Success:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000003 :: unknown:ontapi :: 198.19.0.61:35968 :: unknown:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <net-interface-create>           <address>198.19.0.141</address>           <comment>cluster Lif for SVM Cluster</comment>                                 <failover-policy>disabled</failover-policy>                                 <is-auto-revert>false</is-auto-revert>           <home-node>localhost</home-node>           <home-port>e0a.pv1</home-port>           <interface-name>clus_1</interface-name>           <netmask>255.255.254.0</netmask>                      <return-record>true</return-record>           <role>cluster</role>           <vserver>Cluster</vserver>         </net-interface-create>       </netapp> :: Pending:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000003 :: unknown:ontapi :: 198.19.0.61:35968 :: unknown:admin :: net-interface-create :: Success:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000005 :: unknown:ontapi :: 198.19.0.61:35968 :: Cluster:admin :: <netapp version="1.30" vfiler="Cluster" xmlns="http://www.netapp.com/filer/admin">         <net-routes-create>           <destination>0.0.0.0/0</destination>           <gateway>198.19.0.1</gateway>                    </net-routes-create>       </netapp> :: Pending:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000005 :: unknown:ontapi :: 198.19.0.61:35968 :: Cluster:admin :: net-routes-create :: Success:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000006 :: unknown:ontapi :: 198.19.0.61:35968 :: unknown:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <cluster-create>           <cluster-name>FsxId037b8b564fe46f4f4</cluster-name>       <license>ETYYFLXUQUMADFAAAAAAAAAAAAAA</license>         </cluster-create>       </netapp> :: Pending:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000003 :: unknown:ontapi :: 198.19.0.61:35210 :: unknown:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <net-interface-create>           <address>198.19.1.111</address>           <comment>cluster Lif for SVM Cluster</comment>                                 <failover-policy>disabled</failover-policy>                                 <is-auto-revert>false</is-auto-revert>           <home-node>localhost</home-node>           <home-port>e0a.pv1</home-port>           <interface-name>clus_2</interface-name>           <netmask>255.255.254.0</netmask>                      <return-record>true</return-record>           <role>cluster</role>           <vserver>Cluster</vserver>         </net-interface-create>       </netapp> :: Pending:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000003 :: unknown:ontapi :: 198.19.0.61:35210 :: unknown:admin :: net-interface-create :: Success:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000005 :: unknown:ontapi :: 198.19.0.61:35210 :: Cluster:admin :: <netapp version="1.30" vfiler="Cluster" xmlns="http://www.netapp.com/filer/admin">         <net-routes-create>           <destination>0.0.0.0/0</destination>           <gateway>198.19.0.1</gateway>                    </net-routes-create>       </netapp> :: Pending:
Sun Nov 06 05:33:13 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000005 :: unknown:ontapi :: 198.19.0.61:35210 :: Cluster:admin :: net-routes-create :: Success:
Sun Nov 06 05:33:14 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 85ffff0000000006 :: unknown:ontapi :: 198.19.0.61:35968 :: unknown:admin :: cluster-create :: Success:
Sun Nov 06 05:33:55 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000006 :: unknown:ontapi :: 198.19.0.61:60526 :: unknown:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">       <cluster-join>         <cluster-ip-address>198.19.0.141</cluster-ip-address>       </cluster-join>     </netapp> :: Pending:
Sun Nov 06 05:33:55 2022  FsxId037b8b564fe46f4f4-02
                                       [kern_audit:info:4203] 85ffff0000000006 :: unknown:ontapi :: 198.19.0.61:60526 :: unknown:admin :: cluster-join :: Success:
Sun Nov 06 05:34:15 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e80000000011 :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:57170 :: FsxId037b8b564fe46f4f4:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-create>           <application>ssh</application>           <authentication-method>password</authentication-method>           <password>XXX</password>           <role-name>admin</role-name>           <user-name>admin</user-name>           <vserver>FsxId037b8b564fe46f4f4</vserver>         </security-login-create>       </netapp> :: Pending:
Sun Nov 06 05:34:15 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e80000000011 :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:57170 :: FsxId037b8b564fe46f4f4:admin :: security-login-create :: Success:
Sun Nov 06 05:34:16 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e80000000013 :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:57170 :: FsxId037b8b564fe46f4f4:admin :: <netapp vfiler="FsxId037b8b564fe46f4f4" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <net-dns-create>       <dns-state>enabled</dns-state>           <skip-config-validation>true</skip-config-validation>           <domains>             <string>ec2.internal</string>           </domains>           <name-servers>             <ip-address>198.19.0.2</ip-address>           </name-servers>         </net-dns-create>       </netapp> :: Pending:
Sun Nov 06 05:34:16 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e80000000013 :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:57170 :: FsxId037b8b564fe46f4f4:admin :: net-dns-create :: Success:
Sun Nov 06 05:34:36 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e80000000018 :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:41298 :: FsxId037b8b564fe46f4f4:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <disk-sanown-assign>           <disk>NET-1.2</disk>          <owner>FsxId037b8b564fe46f4f4-01</owner>           <pool>1</pool>         </disk-sanown-assign>       </netapp> :: Pending:
Sun Nov 06 05:34:36 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e80000000018 :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:41298 :: FsxId037b8b564fe46f4f4:admin :: disk-sanown-assign :: Success:
Sun Nov 06 05:34:36 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e8000000001a :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:41298 :: FsxId037b8b564fe46f4f4:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <disk-sanown-assign>           <disk>NET-2.2</disk>          <owner>FsxId037b8b564fe46f4f4-02</owner>           <pool>1</pool>         </disk-sanown-assign>       </netapp> :: Pending:
Sun Nov 06 05:34:36 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e8000000001a :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:41298 :: FsxId037b8b564fe46f4f4:admin :: disk-sanown-assign :: Success:
Sun Nov 06 05:34:37 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e8000000001d :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:41298 :: FsxId037b8b564fe46f4f4:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <aggr-mirror>           <aggregate>aggr0_FsxId037b8b564fe46f4f4_01</aggregate>                    </aggr-mirror>       </netapp> :: Pending:
Sun Nov 06 05:34:37 2022  FsxId037b8b564fe46f4f4-01
                                       [kern_audit:info:4223] 8503e8000000001d :: FsxId037b8b564fe46f4f4:ontapi :: 198.19.0.61:41298 :: FsxId037b8b564fe46f4f4:admin :: aggr-mirror :: Success:
Press <space> to page down, <return> for next line, or 'q' to quit... q
32 entries were displayed.

大量にログが出力されました。

試しにオプションをつけてみて、どのように出力されるのか確認してみます。

# -instance を指定
FsxId037b8b564fe46f4f4::> security audit log show -instance

                               Log Entry Timestamp: Sun Nov 06 05:28:20 2022
                                              Node: FsxId037b8b564fe46f4f4-01
                                 Log Message Entry: [kern_audit:info:686] mlogd: started
                                        Session ID: 0000000000000000
                                        Command ID: 0000000000000000
                                          Protocol: internal
                              Remote user location: localhost
                                      Vserver name: FsxId037b8b564fe46f4f4
                                          Username: root
                            Command being executed: mlogd: started
                       State of this audit request: Success
       Additional information and/or error message: -

                               Log Entry Timestamp: Sun Nov 06 05:28:21 2022
                                              Node: FsxId037b8b564fe46f4f4-02
                                 Log Message Entry: [kern_audit:info:686] mlogd: started
                                        Session ID: 0000000000000000
                                        Command ID: 0000000000000000
                                          Protocol: internal
                              Remote user location: localhost
                                      Vserver name: FsxId037b8b564fe46f4f4
                                          Username: root
                            Command being executed: mlogd: started
                       State of this audit request: Success
       Additional information and/or error message: -

                               Log Entry Timestamp: Sun Nov 06 05:30:03 2022
                                              Node: FsxId037b8b564fe46f4f4-01
Press <space> to page down, <return> for next line, or 'q' to quit... q
3 entries were displayed.

# -detail を指定
FsxId037b8b564fe46f4f4::> security audit log show -detail
Time                     Vserver         User           Source         State
------------------------ --------------- -------------- -------------- -------
Sun Nov 06 05:28:20 2022 FsxId037b8b564fe46f4f4
                                         root           localhost      Success
  Input  : mlogd: started
Sun Nov 06 05:28:21 2022 FsxId037b8b564fe46f4f4
                                         root           localhost      Success
  Input  : mlogd: started
Sun Nov 06 05:30:03 2022 FsxId037b8b564fe46f4f4
                                         root           localhost      Success
  Input  : mlogd: started
Sun Nov 06 05:30:03 2022 FsxId037b8b564fe46f4f4
                                         root           localhost      Success
  Input  : mlogd: started
Sun Nov 06 05:32:03 2022 FsxId037b8b564fe46f4f4
                                         root           localhost      Success
  Input  : TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:03 +00:00"}
Sun Nov 06 05:32:04 2022 FsxId037b8b564fe46f4f4
                                         root           localhost      Success
  Input  : TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:04 +00:00"}
Sun Nov 06 05:33:12 2022 Default         admin          198.19.0.61    Pending
  Input  : <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp>
Sun Nov 06 05:33:12 2022 Default         admin          198.19.0.61    Success
  Input  : security-login-modify-password
Sun Nov 06 05:33:12 2022 Default         admin          198.19.0.61    Pending
  Input  : <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp>
Sun Nov 06 05:33:12 2022 Default         admin          198.19.0.61    Success
  Input  : security-login-modify-password
Sun Nov 06 05:33:13 2022 unknown         admin          198.19.0.61    Pending
  Input  : <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <net-interface-create>           <address>198.19.0.141</address>           <comment>cluster Lif for SVM Cluster</comment>                                 <failover-policy>disabled</failover-policy>                                 <is-auto-revert>false</is-auto-revert>           <home-node>localhost</home-node>           <home-port>e0a.pv1</home-port>           <interface-name>clus_1</interface-name>           <netmask>255.255.254.0</netmask>                      <return-record>true</return-record>           <role>cluster</role>           <vserver>Cluster</vserver>         </net-interface-create>       </netapp>
Sun Nov 06 05:33:13 2022 unknown         admin          198.19.0.61    Success
  Input  : net-interface-create
Sun Nov 06 05:33:13 2022 Cluster         admin          198.19.0.61    Pending
  Input  : <netapp version="1.30" vfiler="Cluster" xmlns="http://www.netapp.com/filer/admin">         <net-routes-create>           <destination>0.0.0.0/0</destination>           <gateway>198.19.0.1</gateway>                    </net-routes-create>       </netapp>
Press <space> to page down, <return> for next line, or 'q' to quit... q
13 entries were displayed.

# -fields を指定
FsxId037b8b564fe46f4f4::> security audit log show -fields timestamp, node, entry, session-id, command-id, application, location, vserver, username, input, state, message
timestamp                  node                      entry                                session-id       command-id       application location  vserver                username input          state   message
-------------------------- ------------------------- ------------------------------------ ---------------- ---------------- ----------- --------- ---------------------- -------- -------------- ------- -------
"Sun Nov 06 05:28:20 2022" FsxId037b8b564fe46f4f4-01 [kern_audit:info:686] mlogd: started 0000000000000000 0000000000000000 internal    localhost FsxId037b8b564fe46f4f4 root     mlogd: started Success -
"Sun Nov 06 05:28:21 2022" FsxId037b8b564fe46f4f4-02 [kern_audit:info:686] mlogd: started 0000000000000000 0000000000000000 internal    localhost FsxId037b8b564fe46f4f4 root     mlogd: started Success -
"Sun Nov 06 05:30:03 2022" FsxId037b8b564fe46f4f4-01 [kern_audit:info:657] mlogd: started 0000000000000000 0000000000000000 internal    localhost FsxId037b8b564fe46f4f4 root     mlogd: started Success -
"Sun Nov 06 05:30:03 2022" FsxId037b8b564fe46f4f4-02 [kern_audit:info:657] mlogd: started 0000000000000000 0000000000000000 internal    localhost FsxId037b8b564fe46f4f4 root     mlogd: started Success -
"Sun Nov 06 05:32:03 2022" FsxId037b8b564fe46f4f4-02 [kern_audit:info:4203] TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:03 +00:00"}
                                                                                          0000000000000000 0000000000000000 internal    localhost FsxId037b8b564fe46f4f4 root     TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:03 +00:00"}
                                                                                                                                                                                                 Success -
"Sun Nov 06 05:32:04 2022" FsxId037b8b564fe46f4f4-01 [kern_audit:info:4223] TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:04 +00:00"}
                                                                                          0000000000000000 0000000000000000 internal    localhost FsxId037b8b564fe46f4f4 root     TIME_INFO::{localhost,Etc/UTC,"11/6/2022 05:32:04 +00:00"}
                                                                                                                                                                                                 Success -
"Sun Nov 06 05:33:12 2022" FsxId037b8b564fe46f4f4-01 [kern_audit:info:4223] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35968 :: Default:admin :: <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp> :: Pending:
                                                                                          85ffff0000000001 85ffff0000000001 ontapi      198.19.0.61
                                                                                                                                                  Default                admin    <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp>
                                                                                                                                                                                                 Pending -
"Sun Nov 06 05:33:12 2022" FsxId037b8b564fe46f4f4-01 [kern_audit:info:4223] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35968 :: Default:admin :: security-login-modify-password :: Success:
                                                                                          85ffff0000000001 85ffff0000000001 ontapi      198.19.0.61
                                                                                                                                                  Default                admin    security-login-modify-password
                                                                                                                                                                                                 Success -
"Sun Nov 06 05:33:12 2022" FsxId037b8b564fe46f4f4-02 [kern_audit:info:4203] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35210 :: Default:admin :: <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp> :: Pending:
                                                                                          85ffff0000000001 85ffff0000000001 ontapi      198.19.0.61
                                                                                                                                                  Default                admin    <netapp vfiler="Default" version="1.20" xmlns="http://www.netapp.com/filer/admin">         <security-login-modify-password>           <new-password>XXX</new-password>           <user-name>admin</user-name>         </security-login-modify-password>XXX</netapp>
                                                                                                                                                                                                 Pending -
"Sun Nov 06 05:33:12 2022" FsxId037b8b564fe46f4f4-02 [kern_audit:info:4203] 85ffff0000000001 :: unknown:ontapi :: 198.19.0.61:35210 :: Default:admin :: security-login-modify-password :: Success:
                                                                                          85ffff0000000001 85ffff0000000001 ontapi      198.19.0.61
                                                                                                                                                  Default                admin    security-login-modify-password
                                                                                                                                                                                                 Success -
"Sun Nov 06 05:33:13 2022" FsxId037b8b564fe46f4f4-01 [kern_audit:info:4223] 85ffff0000000003 :: unknown:ontapi :: 198.19.0.61:35968 :: unknown:admin :: <netapp version="1.20" xmlns="http://www.netapp.com/filer/admin">         <net-interface-create>           <address>198.19.0.141</address>           <comment>cluster Lif for SVM Cluster</comment>                                 <failover-policy>disabled</failover-policy>                                 <is-auto-revert>false</is-auto-revert>           <home-node>localhost</home-node>           <home-port>e0a.pv1</home-port>           <interface-name>clus_1</interface-name>           <netmask>255.255.254.0</netmask>                      <return-record>true</return-record>           <role>cluster</role>           <vserver>Cluster</vserver>         </net-interface-create>       </netapp> :: Pending:
Press <space> to page down, <return> for next line, or 'q' to quit... q

# -fields を指定
# sshで接続して操作したもの
# ステータスが Error もしくは Success のもの
FsxId037b8b564fe46f4f4::> security audit log show -fields timestamp, node, application, vserver, username, input, state, message -application ssh -state Error|Success
timestamp                  node                      application vserver                username input      state   message
-------------------------- ------------------------- ----------- ---------------------- -------- ---------- ------- -------
"Sun Nov 06 06:02:28 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin Logging in Success -
"Sun Nov 06 06:04:58 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin Question: Warning: These advanced commands ... : y
                                                                                                            Success -
"Sun Nov 06 06:04:58 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin set advanced
                                                                                                            Success -
"Sun Nov 06 06:05:06 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin set admin  Success -
"Sun Nov 06 06:07:08 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin Logging in Success -
"Sun Nov 06 06:29:02 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin Logging out
                                                                                                            Success -
6 entries were displayed.

個人的には-fieldsで表示するフィールドを絞って、-stateでその操作の結果を表示するのが好みです。このぐらいの情報量だと「いつ」「誰が」「どこで」「何経由で」「どんな操作をして」「どんな結果だったのか」が分かりやすいですね。

SSHによるログイン/ログアウト、set advancedset adminがしっかり記録されています。また、security audit log showによるログ記録がされていないことから、CLIのGETリクエストは記録されない設定がされているようです。

試しにSETリクエストにあたる操作もやってみましょう。

ボリュームを作成し、その後ボリュームの階層化ポリシーを変更してみました。

# ボリュームの作成
FsxId037b8b564fe46f4f4::> volume create -vserver svm -volume vol1 -aggregate aggr1 -size 1GB -state online -policy default -unix-permissions ---rwxr-xr-x -type RW -snapshot-policy default -foreground true -tiering-policy snapshot-only -analytics-state off -activity-tracking-state off -anti-ransomware-state disabled
[Job 35] Job succeeded: Successful

# 監査ログの確認
FsxId037b8b564fe46f4f4::> security audit log show -fields timestamp, node, application, vserver, username, input, state, message -application ssh -state Error|Success -timestamp >"Sun Nov 06 06:35:00 2022"
timestamp                  node                      application vserver                username input                                                                                                                                                                                                                                                                                              state   message
-------------------------- ------------------------- ----------- ---------------------- -------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------- -------
"Sun Nov 06 06:38:03 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin volume create -vserver svm -volume vol1 -aggregate aggr1 -size 1GB -state online -policy default -unix-permissions ---rwxr-xr-x -type RW -snapshot-policy default -foreground true -tiering-policy snapshot-only -analytics-state off -activity-tracking-state off -anti-ransomware-state disabled Success -

# ボリュームの確認
FsxId037b8b564fe46f4f4::> volume show
Vserver   Volume       Aggregate    State      Type       Size  Available Used%
--------- ------------ ------------ ---------- ---- ---------- ---------- -----
svm       svm_root     aggr1        online     RW          1GB    972.5MB    0%
svm       vol1         aggr1        online     RW          1GB    972.5MB    0%
2 entries were displayed.

# ボリュームの階層化ポリシーの変更
FsxId037b8b564fe46f4f4::> volume modify -volume vol1 -tiering-policy none
Volume modify successful on volume vol1 of Vserver svm.

# 監査ログの確認
FsxId037b8b564fe46f4f4::> security audit log show -fields timestamp, node, application, vserver, username, input, state, message -application ssh -state Error|Success -timestamp >"Sun Nov 06 06:35:00 2022"
timestamp                  node                      application vserver                username input                                                                                                                                                                                                                                                                                              state   message
-------------------------- ------------------------- ----------- ---------------------- -------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------- -------
"Sun Nov 06 06:38:03 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin volume create -vserver svm -volume vol1 -aggregate aggr1 -size 1GB -state online -policy default -unix-permissions ---rwxr-xr-x -type RW -snapshot-policy default -foreground true -tiering-policy snapshot-only -analytics-state off -activity-tracking-state off -anti-ransomware-state disabled Success -
"Sun Nov 06 06:42:26 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin volume modify -volume vol1 -tiering-policy none                                                                                                                                                                                                                                                    Success -
2 entries were displayed.

ログ記録されていますね。実行したコマンドとコマンドの結果も表示されており分かりやすいです。

管理アクティビティの監査ログをCloudWatch Logsに転送

rsyslogサーバーの用意

次に、管理アクティビティの監査ログをCloudWatch Logsに転送してみます。

2022/11/6現在、直接CloudWatch Logsに転送することはサポートされていません。そのため、一度rsyslogサーバーとなるEC2インスタンスに転送して、rsyslogサーバーから転送されたログをCloudWatch Logsに転送します。

管理アクティビティの監査ログをCloudWatch Logsbに転送する構成図

また、2022/11/6現在、AWS Storage Blogに記載の通りFSx for ONTAPのログ転送先はFSx for ONTAPがあるサブネットに制限されています。そのため、rsyslogサーバーはFSx for ONTAPファイルシステムをデプロイしているサブネットと同じサブネットにデプロイする必要があります。

Log forwarding from FSx for ONTAP multi-AZ file systems is limited to the preferred and standby local subnets, hence we need a syslog server in each subnet.

Auditing user and administrative actions in Amazon FSx for NetApp ONTAP using Splunk | AWS Storage Blog

FSx for ONTAPをMulti-AZでデプロイしており、フェイルオーバーした後も監査ログを転送したい場合は、各AZのサブネットにrsyslogサーバーを用意する必要があるのが要注意ですね。その際は同じログがCloudWatch Logsに転送されないように、各rsyslogサーバーのrsyslogの設定でフィルタリングするか、CloudWatch Agentのfilters オプションで各AZのノード上の監査ログのみ転送する必要があると考えます。

最新のAmazon Linux 2のAMIを使用して、EC2インスタンスをFSx for ONTAPファイルシステムと同じサブネットに作成します。

作成後、rsyslogの設定を行います。

# デフォルトのrsyslogの設定ファイルを確認
$ cat /etc/rsyslog.conf
# rsyslog configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####

# The imjournal module bellow is now used as a message source instead of imuxsock.
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
#$ModLoad imklog # reads kernel messages (the same are read from journald)
#$ModLoad immark  # provides --MARK-- message capability

# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Where to place auxiliary files
$WorkDirectory /var/lib/rsyslog

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

# Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
$OmitLocalLogging on

# File to store the position in the journal
$IMJournalStateFile imjournal.state


#### RULES ####

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log


# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList   # run asynchronously
#$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ### end of the forwarding rule ###

# tcp/514で受け付けるように修正
$ sudo vi /etc/rsyslog.conf

# 修正内容を確認
$ cat /etc/rsyslog.conf
# rsyslog configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####

# The imjournal module bellow is now used as a message source instead of imuxsock.
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
#$ModLoad imklog # reads kernel messages (the same are read from journald)
#$ModLoad immark  # provides --MARK-- message capability

# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Where to place auxiliary files
$WorkDirectory /var/lib/rsyslog

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

# Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
$OmitLocalLogging on

# File to store the position in the journal
$IMJournalStateFile imjournal.state


#### RULES ####

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages

# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog


# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*

# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log


# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList   # run asynchronously
#$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ### end of the forwarding rule ###

# ファシリティ local0 の全てのプライオリティのログ は /var/log/fsxn-audit.log に転送するよう設定
$ sudo vi /etc/rsyslog.d/fsxn.conf

# 設定内容を確認
$ cat /etc/rsyslog.d/fsxn.conf
local0.*                                            /var/log/fsxn-audit.log

# rsyslogのサービスを再起動
$ sudo systemctl restart rsyslog

管理アクティビティの監査ログの転送設定

rsyslogサーバー側の準備ができたら、FSx for ONTAPで管理アクティビティの監査ログの転送設定を行います。

rsyslogサーバーのIPアドレス(10.0.1.108)とポート(514)、プロトコル(tcp-unencrypted)、ログのファシリティ(local0)を指定します。

# 管理アクティビティの監査ログの転送設定を作成
FsxId037b8b564fe46f4f4::> cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false
Testing network connectivity to the destination host 10.0.1.108.

# 監査ログの転送設定がされたことを確認
FsxId037b8b564fe46f4f4::> cluster log-forwarding show

                                                Verify  Syslog
Destination Host         Port   Protocol        Server  Facility
------------------------ ------ --------------- ------  --------
10.0.1.108               514    tcp-unencrypted false   local0

管理アクティビティの監査ログの転送設定が作成されました。

なお、転送先への接続に失敗するとcluster log-forwarding create実行時に以下のようにエラーになります。

FsxId037b8b564fe46f4f4::> cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false
Testing network connectivity to the destination host 10.0.1.108.

Error: command failed: Cannot connect to destination host 10.0.1.108, port 514 from node "FsxId037b8b564fe46f4f4-01". Reason: Failed to connect: Connection refused. Verify
       connectivity to desired host or skip the connectivity check with the "-force" parameter.

rsyslogサーバー側でログが転送されているか確認します。

# ログファイルがあることを確認
$ ls -l /var/log/fsxn-audit.log
-rw------- 1 root root 453 Nov  6 07:25 /var/log/fsxn-audit.log

# ログファイルの中身を確認
$ sudo cat /var/log/fsxn-audit.log
Nov  6 07:25:08 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a575 00010f29 Sun Nov 06 2022 07:25:07 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000d80 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false :: Success

確かに転送されていますね。

ボリュームの階層化ポリシーを変更して、その時のログがrsyslogサーバーに転送されるか確認します。

# ボリュームの階層化ポリシーを変更
FsxId037b8b564fe46f4f4::> volume modify -volume vol1 -tiering-policy all
Volume modify successful on volume vol1 of Vserver svm.
# ボリュームの階層化ポリシーを変更した際のログが転送されているか確認
$ sudo cat /var/log/fsxn-audit.log
Nov  6 07:25:08 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a575 00010f29 Sun Nov 06 2022 07:25:07 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000d80 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false :: Success
Nov  6 07:27:19 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a611 00011446 Sun Nov 06 2022 07:27:17 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000db0 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy all :: Pending
Nov  6 07:27:19 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a617 00011446 Sun Nov 06 2022 07:27:18 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000db0 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy all :: Success

正しく転送されていますね。

CloudWatch Logsへの転送

最後に、CloudWatch Logsへ管理アクティビティの監査ログを転送します。

まず、CloudWatch Agentをrsyslogサーバーにインストールします。

# 現在のディレクトリを確認
$ pwd
/usr/bin

# 書き込み権限があるディレクトリに移動
$ cd /home/ssm-user/

# CloudWatch Agentのrpmをダウンロード
$ wget https://s3.us-east-1.amazonaws.com/amazoncloudwatch-agent-us-east-1/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
--2022-11-06 07:30:42--  https://s3.us-east-1.amazonaws.com/amazoncloudwatch-agent-us-east-1/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
Resolving s3.us-east-1.amazonaws.com (s3.us-east-1.amazonaws.com)... 54.231.134.56
Connecting to s3.us-east-1.amazonaws.com (s3.us-east-1.amazonaws.com)|54.231.134.56|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 49701120 (47M) [application/octet-stream]
Saving to: ‘amazon-cloudwatch-agent.rpm’

100%[===========================================================================================================================================================================>] 49,701,120   101MB/s   in 0.5s

2022-11-06 07:30:42 (101 MB/s) - ‘amazon-cloudwatch-agent.rpm’ saved [49701120/49701120]

# CloudWatch Agentをインストール
$ sudo rpm -U ./amazon-cloudwatch-agent.rpm
create group cwagent, result: 0
create user cwagent, result: 0
create group aoc, result: 0
create user aoc, result: 0

CloudWatch Agentをrsyslogサーバーにインストールした後、CloudWatch Logsへ管理アクティビティの監査ログを転送するよう設定ファイルを作成してサービスを起動させます。設定ファイルはウィザードを使って作成してみました。

# ウィザードでCloudWatch Agentの設定ファイルを作成
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
================================================================
= Welcome to the Amazon CloudWatch Agent Configuration Manager =
=                                                              =
= CloudWatch Agent allows you to collect metrics and logs from =
= your host and send them to CloudWatch. Additional CloudWatch =
= charges may apply.                                           =
================================================================
On which OS are you planning to use the agent?
1. linux
2. windows
3. darwin
default choice: [1]:
1
Trying to fetch the default region based on ec2 metadata...
Are you using EC2 or On-Premises hosts?
1. EC2
2. On-Premises
default choice: [1]:
1
Which user are you planning to run the agent?
1. root
2. cwagent
3. others
default choice: [1]:
1
Do you want to turn on StatsD daemon?
1. yes
2. no
default choice: [1]:
2
Do you want to monitor metrics from CollectD? WARNING: CollectD must be installed or the Agent will fail to start
1. yes
2. no
default choice: [1]:
2
Do you want to monitor any host metrics? e.g. CPU, memory, etc.
1. yes
2. no
default choice: [1]:
2
Do you have any existing CloudWatch Log Agent (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html) configuration file to import for migration?
1. yes
2. no
default choice: [2]:
2
Do you want to monitor any log files?
1. yes
2. no
default choice: [1]:
1
Log file path:
/var/log/fsxn-audit.log
Log group name:
default choice: [fsxn-audit.log]
/aws/fsxn/audit/fs-037b8b564fe46f4f4
Log stream name:
default choice: [{instance_id}]

Log Group Retention in days
1. -1
2. 1
3. 3
4. 5
5. 7
6. 14
7. 30
8. 60
9. 90
10. 120
11. 150
12. 180
13. 365
14. 400
15. 545
16. 731
17. 1827
18. 2192
19. 2557
20. 2922
21. 3288
22. 3653
default choice: [1]:
7
Do you want to specify any additional log files to monitor?
1. yes
2. no
default choice: [1]:
2
Saved config file to /opt/aws/amazon-cloudwatch-agent/bin/config.json successfully.
Current config as follows:
{
	"agent": {
		"run_as_user": "root"
	},
	"logs": {
		"logs_collected": {
			"files": {
				"collect_list": [
					{
						"file_path": "/var/log/fsxn-audit.log",
						"log_group_name": "/aws/fsxn/audit/fs-037b8b564fe46f4f4",
						"log_stream_name": "{instance_id}",
						"retention_in_days": 30
					}
				]
			}
		}
	}
}
Please check the above content of the config.
The config file is also located at /opt/aws/amazon-cloudwatch-agent/bin/config.json.
Edit it manually if needed.
Do you want to store the config in the SSM parameter store?
1. yes
2. no
default choice: [1]:
2
Program exits now.

# 作成された設定ファイルを指定してCloudWatch Agentのサービスを起動する
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
****** processing amazon-cloudwatch-agent ******
/opt/aws/amazon-cloudwatch-agent/bin/config-downloader --output-dir /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d --download-source file:/opt/aws/amazon-cloudwatch-agent/bin/config.json --mode ec2 --config /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml --multi-config default
I! Trying to detect region from ec2
D! [EC2] Found active network interface
Successfully fetched the config and saved in /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/file_config.json.tmp
Start configuration validation...
/opt/aws/amazon-cloudwatch-agent/bin/config-translator --input /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json --input-dir /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d --output /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml --mode ec2 --config /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml --multi-config default
2022/11/06 07:52:22 Reading json config file path: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/file_config.json.tmp ...
2022/11/06 07:52:22 I! Valid Json input schema.
I! Detecting run_as_user...
I! Trying to detect region from ec2
D! [EC2] Found active network interface
No csm configuration found.
No metric configuration found.
Configuration validation first phase succeeded
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent -schematest -config /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml
Configuration validation second phase succeeded
Configuration validation succeeded
amazon-cloudwatch-agent has already been stopped
Created symlink from /etc/systemd/system/multi-user.target.wants/amazon-cloudwatch-agent.service to /etc/systemd/system/amazon-cloudwatch-agent.service.
Redirecting to /bin/systemctl restart amazon-cloudwatch-agent.service

# サービスが起動されたことを確認する
$ systemctl status amazon-cloudwatch-agent.service
● amazon-cloudwatch-agent.service - Amazon CloudWatch Agent
   Loaded: loaded (/etc/systemd/system/amazon-cloudwatch-agent.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2022-11-06 07:52:22 UTC; 1min 22s ago
 Main PID: 3325 (amazon-cloudwat)
   CGroup: /system.slice/amazon-cloudwatch-agent.service
           └─3325 /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent -config /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml -envconfig /opt/aws/amazon-cloudwatch-agent/etc/env-confi...

$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
{
  "status": "running",
  "starttime": "2022-11-06T07:52:22+0000",
  "configstatus": "configured",
  "cwoc_status": "stopped",
  "cwoc_starttime": "",
  "cwoc_configstatus": "not configured",
  "version": "1.247355.0b252062"
}

設定後、CloudWatch Logsを確認すると、指定したロググループに管理アクティビティの監査ログが転送されていました。

CloudWatch Logsの確認

ボリュームの階層化ポリシーを変更してみて、その時のログが追加されたことも確認できました。

ログが更新されることを確認

最後にFsx for ONTAPファイルシステムを削除するときのログを確認します。

Fsx for ONTAPファイルシステムを削除するためにはSVMを全て削除する必要があります。また、SVMを削除するためにはルートボリューム以外のボリュームを全て削除する必要があります。

SVMにアタッチしているボリュームを試しにAWSマネジメントコンソールから削除してみました。

その時の監査ログは以下のとおりです。

FsxId037b8b564fe46f4f4::> security audit log show -fields timestamp, node, application, vserver, username, input, state, message -state Error|Success -timestamp >"Sun Nov 06 07:00:00 2022"
timestamp                  node                      application vserver                username input      state   message
-------------------------- ------------------------- ----------- ---------------------- -------- ---------- ------- -------
"Sun Nov 06 07:18:24 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin Logging in Success -
"Sun Nov 06 07:21:54 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin cluster log-forwarding create -destination
                                                                                                            Error   Missing value for -destination.
"Sun Nov 06 07:22:08 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local5 - force false
                                                                                                            Success -
"Sun Nov 06 07:22:46 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false
                                                                                                            Error   Cannot connect to destination host 10.0.1.108, port 514 from node "FsxId037b8b564fe46f4f4-01". Reason: Failed to connect: Connection refused. Verify connectivity to desired host or skip the connectivity check with the "-force" parameter.
"Sun Nov 06 07:25:07 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false
                                                                                                            Success -
"Sun Nov 06 07:27:18 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin volume modify -volume vol1 -tiering-policy all
                                                                                                            Success -
"Sun Nov 06 07:31:24 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin Logging out
                                                                                                            Success -
"Sun Nov 06 07:38:47 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin volume modify -volume vol1 -tiering-policy none
                                                                                                            Success -
"Sun Nov 06 07:56:09 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin volume modify -volume vol1 -tiering-policy snapshot-only
                                                                                                            Success -
"Sun Nov 06 07:57:58 2022" FsxId037b8b564fe46f4f4-01 http        FsxId037b8b564fe46f4f4 fsx-control-plane
                                                                                                 DELETE /api/storage/volumes/8ddf36cc-5d9d-11ed-a5fa-f54d5ac94481
                                                                                                            Success -
"Sun Nov 06 08:00:38 2022" FsxId037b8b564fe46f4f4-01 ssh         FsxId037b8b564fe46f4f4 fsxadmin top        Success -
11 entries were displayed.

fsx-control-planeというユーザーでONTAPのREST APIを使ってボリュームが削除されたことを確認できました。

次に、SVMとFSx for ONTAPファイルシステムをAWSマネジメントコンソールから削除しました。

その時にCloudWatch Logsに転送されたログは以下の通りです。

[cloudshell-user@ip-10-1-181-202 ~]$ aws logs tail /aws/fsxn/audit/fs-037b8b564fe46f4f4 --since  3hours
2022-11-06T07:52:23.667000+00:00 i-00350174f8baff0fa Nov  6 07:25:08 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a575 00010f29 Sun Nov 06 2022 07:25:07 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000d80 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: cluster log-forwarding create -destination 10.0.1.108 -port 514 -protocol tcp-unencrypted -facility local0 -verify-server false -force false :: Success
2022-11-06T07:52:23.667000+00:00 i-00350174f8baff0fa Nov  6 07:27:19 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a611 00011446 Sun Nov 06 2022 07:27:17 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000db0 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy all :: Pending
2022-11-06T07:52:23.667000+00:00 i-00350174f8baff0fa Nov  6 07:27:19 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a617 00011446 Sun Nov 06 2022 07:27:18 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000db0 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy all :: Success
2022-11-06T07:52:23.667000+00:00 i-00350174f8baff0fa Nov  6 07:31:25 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a7b4 00011de2 Sun Nov 06 2022 07:31:24 +00:00 [kern_audit:info:4223] 8003e800000004b4:8003e80000000e18 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.56:40502 :: FsxId037b8b564fe46f4f4:fsxadmin :: Logging out :: Success
2022-11-06T07:52:23.667000+00:00 i-00350174f8baff0fa Nov  6 07:38:48 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a9ed 00012f28 Sun Nov 06 2022 07:38:46 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000ee4 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy none :: Pending
2022-11-06T07:52:29.033000+00:00 i-00350174f8baff0fa Nov  6 07:38:48 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000a9f3 00012f28 Sun Nov 06 2022 07:38:47 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000000ee4 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy none :: Success
2022-11-06T07:56:11.267000+00:00 i-00350174f8baff0fa Nov  6 07:56:11 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000afa3 000157e6 Sun Nov 06 2022 07:56:09 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000001092 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy snapshot-only :: Pending
2022-11-06T07:56:15.668000+00:00 i-00350174f8baff0fa Nov  6 07:56:11 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000afa9 000157e6 Sun Nov 06 2022 07:56:09 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e80000001092 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: volume modify -volume vol1 -tiering-policy snapshot-only :: Success
2022-11-06T07:57:59.828000+00:00 i-00350174f8baff0fa Nov  6 07:57:59 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b03f 00015c25 Sun Nov 06 2022 07:57:58 +00:00 [kern_audit:info:4223] 8503e80000000ca4 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:18406 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: DELETE /api/storage/volumes/8ddf36cc-5d9d-11ed-a5fa-f54d5ac94481 :: Pending
2022-11-06T07:58:04.668000+00:00 i-00350174f8baff0fa Nov  6 07:57:59 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b040 00015c25 Sun Nov 06 2022 07:57:58 +00:00 [kern_audit:info:4223] 8503e80000000ca4 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:18406 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: DELETE /api/storage/volumes/8ddf36cc-5d9d-11ed-a5fa-f54d5ac94481 :: Success:
2022-11-06T08:00:39.560000+00:00 i-00350174f8baff0fa Nov  6 08:00:39 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b128 00016261 Sun Nov 06 2022 08:00:38 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e800000011b6 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: top :: Pending
2022-11-06T08:00:43.668000+00:00 i-00350174f8baff0fa Nov  6 08:00:39 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b129 00016261 Sun Nov 06 2022 08:00:38 +00:00 [kern_audit:info:4223] 8003e80000000cc2:8003e800000011b6 :: FsxId037b8b564fe46f4f4:ssh :: 10.0.1.108:36684 :: FsxId037b8b564fe46f4f4:fsxadmin :: top :: Success
2022-11-06T08:03:28.340000+00:00 i-00350174f8baff0fa Nov  6 08:03:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b25e 000168fa Sun Nov 06 2022 08:03:26 +00:00 [kern_audit:info:4223] 8503e80000000d19 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:17944 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: DELETE /api/storage/volumes/17f10fa6-5d9d-11ed-a5fa-f54d5ac94481 :: Pending
2022-11-06T08:03:32.668000+00:00 i-00350174f8baff0fa Nov  6 08:03:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b25f 000168fa Sun Nov 06 2022 08:03:26 +00:00 [kern_audit:info:4223] 8503e80000000d19 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:17944 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: DELETE /api/storage/volumes/17f10fa6-5d9d-11ed-a5fa-f54d5ac94481 :: Success:
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2e5 00016b54 Sun Nov 06 2022 08:04:26 +00:00 [kern_audit:info:4223] 8503e80000000d31 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:49620 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/nfs/kerberos/interface/?vserver=svm&fields=kerberos&kerberos=true :: Pending
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2e6 00016b54 Sun Nov 06 2022 08:04:26 +00:00 [kern_audit:info:4223] 8503e80000000d31 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:49620 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/nfs/kerberos/interface/?vserver=svm&fields=kerberos&kerberos=true :: Success:
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2e8 00016b54 Sun Nov 06 2022 08:04:26 +00:00 [kern_audit:info:4223] 8503e80000000d32 :: FsxId037b8b564fe46f4f4:http :: 52.87.48.44:42650 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/snapmirror/policy/?vserver=svm :: Pending
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2e9 00016b54 Sun Nov 06 2022 08:04:26 +00:00 [kern_audit:info:4223] 8503e80000000d32 :: FsxId037b8b564fe46f4f4:http :: 52.87.48.44:42650 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/snapmirror/policy/?vserver=svm :: Success:
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2ea 00016b54 Sun Nov 06 2022 08:04:26 +00:00 [kern_audit:info:4223] 8503e80000000d34 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:5333 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/lun/portset/?vserver=svm&fields=vserver%2Cuuid%2Cport-name%2Cprotocol%2Cport-count :: Pending
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2eb 00016b54 Sun Nov 06 2022 08:04:26 +00:00 [kern_audit:info:4223] 8503e80000000d34 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:5333 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/lun/portset/?vserver=svm&fields=vserver%2Cuuid%2Cport-name%2Cprotocol%2Cport-count :: Success:
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2ec 00016b54 Sun Nov 06 2022 08:04:27 +00:00 [kern_audit:info:4223] 8503e80000000d35 :: FsxId037b8b564fe46f4f4:http :: 35.169.159.241:12602 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/iscsi/security?vserver=svm :: Pending
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2ed 00016b54 Sun Nov 06 2022 08:04:27 +00:00 [kern_audit:info:4223] 8503e80000000d35 :: FsxId037b8b564fe46f4f4:http :: 35.169.159.241:12602 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/iscsi/security?vserver=svm :: Success:
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2ee 00016b54 Sun Nov 06 2022 08:04:27 +00:00 [kern_audit:info:4223] 8503e80000000d36 :: FsxId037b8b564fe46f4f4:http :: 35.169.159.241:33135 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/iscsi/isns?vserver=svm :: Pending
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2ef 00016b54 Sun Nov 06 2022 08:04:27 +00:00 [kern_audit:info:4223] 8503e80000000d36 :: FsxId037b8b564fe46f4f4:http :: 35.169.159.241:33135 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/iscsi/isns?vserver=svm :: Success:
2022-11-06T08:04:28.531000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2f0 00016b54 Sun Nov 06 2022 08:04:27 +00:00 [kern_audit:info:4223] 8503e80000000d37 :: FsxId037b8b564fe46f4f4:http :: 52.87.48.44:39144 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/iscsi/tpgroup?vserver=svm :: Pending
2022-11-06T08:04:32.667000+00:00 i-00350174f8baff0fa Nov  6 08:04:28 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b2f1 00016b54 Sun Nov 06 2022 08:04:27 +00:00 [kern_audit:info:4223] 8503e80000000d37 :: FsxId037b8b564fe46f4f4:http :: 52.87.48.44:39144 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: GET /api/private/cli/vserver/iscsi/tpgroup?vserver=svm :: Success:
2022-11-06T08:05:04.391000+00:00 i-00350174f8baff0fa Nov  6 08:05:04 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b327 00016cb9 Sun Nov 06 2022 08:04:57 +00:00 [kern_audit:info:4223] 8503e80000000d46 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:44027 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: DELETE /api/svm/svms/11c83e46-5d9d-11ed-a5fa-f54d5ac94481 :: Pending
2022-11-06T08:05:08.668000+00:00 i-00350174f8baff0fa Nov  6 08:05:04 ip-10-0-1-82.ec2.internal FsxId037b8b564fe46f4f4-01: FsxId037b8b564fe46f4f4-01: 00000002.0000b328 00016cb9 Sun Nov 06 2022 08:04:57 +00:00 [kern_audit:info:4223] 8503e80000000d46 :: FsxId037b8b564fe46f4f4:http :: 52.204.237.29:44027 :: FsxId037b8b564fe46f4f4:fsx-control-plane :: DELETE /api/svm/svms/11c83e46-5d9d-11ed-a5fa-f54d5ac94481 :: Success:

SVMのルートボリュームの削除やSVMが削除された時のログは残っていますが、流石にFSx for ONTAPファイルシステムが削除されたときのログは転送されていないですね。

また、SVMを削除する前にSnapMirrorやiSCSIの情報をGETで取得していることが分かります。どうやら管理アクティビティの監査ログはONTAP CLIのGETリクエストは記録しないですが、ONTAPのREST APIのGETリクエストは記録するようです。

監査ログから誰がいつ操作したのか簡単に確認できる

Amazon FSx for NetApp ONTAPの管理アクティビティの監査ログを確認してみました。

FSx for ONTAPから監査ログを見る分には特別な設定は必要なく、非常に簡単にログを確認できました。

CloudWatch Logsに転送するのは一手間必要ですが、ポイントを掴めば簡単ですね。

なお、今回は設定していませんが、何もしなければrsyslogサーバーにログが溜まり続けてしまいます。本番運用するのであれば、logrotate.dでログローテーションをするように設定してください。

この記事が誰かの助けになれば幸いです。

以上、AWS事業本部 コンサルティング部の のんピ(@non____97)でした!