3.3. Elytron の定期ローテーションファイル監査ロギングの有効化
elytron サブシステムを使用して、スタンドアロンサーバーまたはマネージドドメインとして実行されているサーバーの定期ローテーションファイル監査ロギングを有効にできます。
定期ローテーションファイル監査ロギングでは、設定されたスケジュールに基づいて監査ログファイルを自動的にローテーションします。定期ローテーションファイル監査ロギングは、デフォルトのファイル監査ロギングに似ていますが、定期ローテーションファイル監査ロギングには、suffix という追加の属性が含まれています。
suffix 属性の値は、java.time.format.DateTimeFormatter 形式で指定された日付 (.yyyy-MM-dd など) です。Elytron は、その接尾辞で指定された値から自動的にローテーションの周期を計算します。elytron サブシステムは、ログファイル名の最後に接尾辞を付加します。
前提条件
アプリケーションをセキュリティー保護している。
詳細は、Elytron での
aggregate-realmの作成 を参照してください。
手順
定期的なローテーションファイル監査ログを作成します。
構文
/subsystem=elytron/periodic-rotating-file-audit-log=<periodic_audit_log_name>:add(path="<periodic_audit_log_filename>",format=<record_format>,synchronized=<whether_to_log_immediately>,suffix="<suffix_in_DateTimeFormatter_format>")例
/subsystem=elytron/periodic-rotating-file-audit-log=examplePreiodicFileAuditLog:add(path="periodic-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,suffix="yyyy-MM-dd")定期的なローテーションファイル監査ロガーをセキュリティードメインに追加します。
構文
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<periodic_audit_log_name>)例
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=examplePreiodicFileAuditLog)
検証
ブラウザーで、セキュリティー保護されたアプリケーションにログインします。
たとえば、セキュリティードメインを使用したアプリケーションユーザーの認証と認可 で作成したアプリケーションにログインするには、http://localhost:8080/simple-webapp-example/secured に移動してログインします。
監査ログを保存するように設定されたディレクトリーに移動します。この手順のコマンド例を使用する場合、ディレクトリーは EAP_HOME/standalone/log です。
periodic-file-audit.logというファイルが作成されることに注意してください。これには、アプリケーションへのログインによってトリガーされたイベントのログが含まれています。periodic-file-audit.log ファイルの例
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}