giip
SES Proposal
Aurora MySQL監査ログログファイルパラメータAurora監視

How to Collect and Review Audit Logs in Aurora MySQL

公開日 2026-08-13 · 更新日 2026-08-13 · 最終検証日 2026-08-13

結論

To collect audit logs in Aurora MySQL, set `server_audit_logging` to 1 in the DB cluster parameter group and specify the event types to record in `server_audit_events` (CONNECT, QUERY, QUERY_DCL, QUERY_DDL, QUERY_DML, TABLE). You can narrow the scope with `server_audit_incl_users` / `server_audit_excl_users`. Output goes to RDS log files and CloudWatch Logs. All of these are cluster-level settings.

この文書の適用条件

対象製品Aurora MySQL (MySQL-compatible edition) Advanced Auditing
確認バージョンAurora MySQL 2.x (MySQL 5.7-compatible) / 3.x (MySQL 8.0-compatible). Details of available event types vary by version — verify in your actual environment
適用環境Amazon Aurora (AWS). Amazon RDS for MySQL has no feature of the same name
必要権限Changing parameters requires IAM `rds:ModifyDBClusterParameterGroup`; retrieving logs requires `rds:DescribeDBLogFiles` / `rds:DownloadDBLogFilePortion`. Enabling CloudWatch Logs export requires `rds:ModifyDBCluster`
実行影響No impact from read-only checks. Enabling auditing increases recording volume and adds load to write processing
再起動Varies by parameter — check `ApplyType`. Items that cannot be applied with `immediate` require a restart
最終検証日2026-08-13

そのまま実行できるコマンド

Check the current audit settings参照のみ
対象
Aurora MySQL 2.x / 3.x
権限
Connection privilege (read global variables)
変更作業
None (read-only)
Production実行
Possible
-- 対象: Aurora MySQL 2.x / 3.x
-- 権限: 接続権限(グローバル変数の参照のみ)
-- 変更作業: なし(参照のみ)
-- Production 実行: 可能
SHOW GLOBAL VARIABLES WHERE Variable_name IN (
    'server_audit_logging',
    'server_audit_events',
    'server_audit_incl_users',
    'server_audit_excl_users'
);

If these variables don't appear, Advanced Auditing is not configured on that cluster. Check the parameter group side. If `server_audit_logging` is 0, auditing is not being recorded.

Check the audit settings on the cluster parameter group side参照のみ
対象
Aurora MySQL (DB cluster parameter group)
権限
IAM: `rds:DescribeDBClusterParameters`
変更作業
None (read-only)
Production実行
Possible
# 対象: Aurora MySQL(DBクラスターパラメータグループ)
# 権限: IAM rds:DescribeDBClusterParameters
# 変更作業: なし(参照のみ)
# Production 実行: 可能
aws rds describe-db-cluster-parameters \
  --db-cluster-parameter-group-name example-aurora-mysql-cluster-params \
  --query "Parameters[?starts_with(ParameterName, 'server_audit')].{Name:ParameterName,Value:ParameterValue,Apply:ApplyType,Source:Source}" \
  --output table

If the `Apply` column (`ApplyType`) is `dynamic`, it can be applied without a restart; if `static`, a restart is required. If `Source` is `engine-default`, that parameter has no explicit setting.

Enable the audit log
対象
Aurora MySQL (DB cluster parameter group)
権限
IAM: `rds:ModifyDBClusterParameterGroup`
変更作業
Yes (changes the audit setting for the whole cluster)
Production実行
Carry out only after going through change management. Expect an increase in recording volume
# 対象: Aurora MySQL(DBクラスターパラメータグループ)
# 権限: IAM rds:ModifyDBClusterParameterGroup
# 変更作業: あり(クラスター全体に効く監査設定の変更)
# Production 実行: 変更管理を通したうえで実施。記録量の増加を必ず見込むこと

# 値にカンマを含むため、shorthand ではなく JSON 形式で指定する
aws rds modify-db-cluster-parameter-group \
  --db-cluster-parameter-group-name example-aurora-mysql-cluster-params \
  --parameters '[
    {"ParameterName":"server_audit_logging","ParameterValue":"1","ApplyMethod":"immediate"},
    {"ParameterName":"server_audit_events","ParameterValue":"CONNECT,QUERY_DDL,QUERY_DCL","ApplyMethod":"immediate"},
    {"ParameterName":"server_audit_excl_users","ParameterValue":"rdsadmin","ApplyMethod":"immediate"}
  ]'

The main values available for `server_audit_events` are CONNECT / QUERY / QUERY_DCL / QUERY_DDL / QUERY_DML / TABLE. It's safer to start with CONNECT, QUERY_DDL, and QUERY_DCL, and add QUERY or QUERY_DML only once needed. `QUERY` records every SQL statement, so recording volume spikes. Match `ApplyMethod` to the `ApplyType` checked earlier.

Export the audit log to CloudWatch Logs
対象
Aurora MySQL (DB cluster)
権限
IAM: `rds:ModifyDBCluster`
変更作業
Yes (adds a log export destination)
Production実行
Possible. Costs accrue according to CloudWatch Logs ingestion volume
# 対象: Aurora MySQL(DBクラスター)
# 権限: IAM rds:ModifyDBCluster
# 変更作業: あり(ログ出力先の追加)
# Production 実行: 可能。ただしCloudWatch Logsの取り込み量に応じた料金が発生する

aws rds modify-db-cluster \
  --db-cluster-identifier example-aurora-cluster \
  --cloudwatch-logs-export-configuration '{"EnableLogTypes":["audit"]}' \
  --apply-immediately

# 現在の出力設定を確認する
aws rds describe-db-clusters \
  --db-cluster-identifier example-aurora-cluster \
  --query 'DBClusters[0].EnabledCloudwatchLogsExports' \
  --output text

Exporting to CloudWatch Logs lets you set a retention period, search with Logs Insights, and alert via metric filters. Since costs accrue based on ingestion volume and storage, narrow the audit scope before enabling this.

Retrieve the audit log as an RDS log file参照のみ
対象
Aurora MySQL instance
権限
IAM: `rds:DescribeDBLogFiles`, `rds:DownloadDBLogFilePortion`
変更作業
None (read-only)
Production実行
Possible
# 対象: Aurora MySQL インスタンス
# 権限: IAM rds:DescribeDBLogFiles, rds:DownloadDBLogFilePortion
# 変更作業: なし(参照のみ)
# Production 実行: 可能

# 1) 監査ログのファイル一覧を取得する
aws rds describe-db-log-files \
  --db-instance-identifier example-aurora-instance \
  --filename-contains audit \
  --query 'DescribeDBLogFiles[].{Name:LogFileName,Size:Size,LastWritten:LastWritten}' \
  --output table

# 2) 1) で得たファイル名を指定して内容を取得する
aws rds download-db-log-file-portion \
  --db-instance-identifier example-aurora-instance \
  --log-file-name "audit/audit.log.0.0" \
  --starting-token 0 \
  --output text

The log file name changes with the environment and time, so always use the value obtained from the list in step 1. Since the audit log is output per instance, you need to check both the writer and the reader.

Search the audit log with CloudWatch Logs Insights参照のみ
対象
CloudWatch Logs (Aurora MySQL's audit log group)
権限
IAM: `logs:StartQuery`, `logs:GetQueryResults`
変更作業
None (read-only)
Production実行
Possible
# 対象: CloudWatch Logs(Aurora MySQL の audit ロググループ)
# 権限: IAM logs:StartQuery, logs:GetQueryResults
# 変更作業: なし(参照のみ)
# Production 実行: 可能

# 監査ログはカンマ区切りのレコードとして出力されるため、まず生の行を数件確認し、
# 実際のフィールド順を目視で確認してから parse のパターンを決める
fields @timestamp, @message
| sort @timestamp desc
| limit 20

# 特定ユーザーの操作だけを抽出する例(フィールド順を確認したうえで使う)
fields @timestamp, @message
| filter @message like /sample_user/
| sort @timestamp desc
| limit 100

An audit log record is a comma-separated line listing the timestamp, connection source, user, connection ID, operation type, target object, and so on. Since the field order may differ by version, always check a few raw rows of actual data before mechanically parsing it with `parse`.

結果の読み方

意味確認するポイント
server_audit_loggingWhether the audit log is enabledIf not 1, nothing is being recorded
server_audit_eventsEvent types to record (comma-separated)Which of CONNECT / QUERY / QUERY_DCL / QUERY_DDL / QUERY_DML / TABLE is included. Including `QUERY` means a large recording volume
server_audit_incl_usersUsers to include in recordingIf specified, the operations of users not listed here are not recorded
server_audit_excl_usersUsers to exclude from recordingExcluding monitoring accounts or `rdsadmin` can reduce recording volume
ApplyType (parameter side)How the parameter is appliedRequires a restart if `static`; can apply immediately if `dynamic`
LogFileNameRDS log file nameUse this value as-is when downloading
Size / LastWrittenFile size and last-written timeThe growth in size is the measured recording volume. Compare it before and after a setting change

こういう状況で使います

  • Can't later check "who changed this table and when"
  • An audit requirement came up, but it's unclear how much is currently being recorded
  • The audit log seems to have been enabled, but the log file is not growing
  • Enabling the audit log caused the log volume to far exceed expectations
  • A slow query log exists, but there is no record of successful operations

考えられる原因(可能性の高い順)

  1. 01

    `server_audit_logging` is not enabled

    Even with event types configured, nothing is recorded while `server_audit_logging` stays 0. Check this value first.

  2. 02

    The instance-level parameter group was edited instead

    Advanced Auditing settings live in the DB cluster parameter group. Editing the instance-level DB parameter group has no effect.

  3. 03

    The `server_audit_incl_users` setting narrows the scope too much

    When you specify users to include, operations by any other user are not recorded. Check whether something was unintentionally excluded.

  4. 04

    A `static` parameter has not been applied via a restart

    Items whose `ApplyType` is `static` do not take effect until a restart. The value in the parameter group and the actual running value can be out of sync.

  5. 05

    Including `QUERY` in `server_audit_events` caused a surge in recording volume

    `QUERY` covers every SQL statement. On a high-traffic instance, this greatly increases recording volume, affecting both log storage cost and write load.

確認手順

  1. 1

    Check both the running value and the parameter group value

    参照のみ

    Check the global variables via SQL and the parameter group value plus `ApplyType` via the CLI. A mismatch between the two means the change has not been applied.

  2. 2

    Check how log files are being generated

    参照のみ

    Use `describe-db-log-files` to check the list of audit log files, their sizes, and last-written times.

  3. 3

    Retrieve a few actual records and check the format

    参照のみ

    Check raw lines via `download-db-log-file-portion` or CloudWatch Logs to see whether the needed information is present.

  4. 4

    Measure the actual increase in recording volume

    参照のみ

    Compare the growth in log file size before and after the setting change. Measure it rather than relying on an estimate.

  5. 5

    Measure the performance impact in a test environment

    Apply a load equivalent to production and measure the difference with and without auditing. The magnitude depends on the workload.

対応方法

すぐに実施できる低リスクの対応

  • Decide the recording purpose first

    参照のみ

    The event types you need differ depending on whether the goal is "detecting unauthorized access," "tracking change operations," or "understanding access sources." Enabling everything without a defined purpose just increases recording volume.

  • Start with CONNECT and DDL / DCL

    Connections plus privilege changes and schema changes alone often satisfy the core of audit requirements while keeping recording volume down.

事前検討が必要な変更

  • Configure excluded users

    Add monitoring read-only accounts or administrative accounts to `server_audit_excl_users` to reduce noise. Since excluded operations are not recorded, document the exclusion policy.

  • Export to CloudWatch Logs and set a retention period

    Set the log group's retention period to match audit requirements. If long-term retention is needed, also consider exporting to S3.

  • Decide on detection rules

    Define metric filters for events that should trigger a notification, such as granting privileges, dropping tables, or connections from an unexpected host.

再起動・サービス影響を伴う変更

  • Include `QUERY` and record every SQL statement

    This maximizes traceability but significantly increases recording volume and impact on write processing. Always measure load and recording volume in a test environment before deciding.

  • Restart the instance to apply `static` parameters

    A restart causes a connection drop. Treat it as a planned outage.

!注意事項

  • Including `QUERY` in `server_audit_events` makes every executed SQL statement subject to recording. On a high-traffic instance, recording volume increases substantially. Since the increase and performance impact vary by environment, this article does not give a specific ratio — always measure it in a test environment.
  • Since the audit log contains SQL statements, personal information or sensitive values written as literals remain in the log. Decide where logs are stored and who can access them beforehand.
  • Setting excluded users means that user's operations are not recorded at all. Exclusion creates a blind spot in the audit, so document the reasoning.
  • Advanced Auditing settings live in the DB cluster parameter group. Editing the instance-level parameter group does not enable it.
  • Exporting to CloudWatch Logs incurs costs based on ingestion volume and storage. Enabling it before narrowing the audit scope can push costs beyond expectations.
  • The audit log records "who did what." It does not tell you "why something was slow." Use the slow query log and Performance Insights for performance investigations.

バージョン・環境による違い

Aurora MySQL 2.x / 3.xAdvanced Auditing is a feature specific to Aurora MySQL. Amazon RDS for MySQL has no feature of the same name, so a different approach (the general log or an external plugin) needs to be considered.
Details of event typesCONNECT / QUERY / QUERY_DCL / QUERY_DDL / QUERY_DML / TABLE are the main values, but handling may differ by version. After configuring it, always verify that the expected operations actually appear in the log.
Log record formatOutput as comma-separated records, but the field order may be version-dependent, so verify with real data before parsing (unverified).

これで解決しない場合に確認すること

  • Check whether the reader instance's audit log is also being collected

    Logs are output per instance. If reads are directed to the reader, the reader-side log is needed too.

  • Check whether the audit log retention period meets requirements

    RDS log files are rotated automatically. If long-term retention is needed, you'll need a design that moves them to CloudWatch Logs or S3.

  • Check whether the application connects using a shared account

    If everyone connects as the same DB user, collecting the audit log still won't let you identify "who."

  • Sort out how this differs from the general log

    The general log records every connection and SQL statement but has no audit-style filtering or exclusion. They serve different purposes.

  • Check who has access to the log

    If too many people can view the audit log, that access itself becomes a leak vector.

この文書の根拠と限界

製品の公式ドキュメントに基づく説明

Based on Amazon Aurora MySQL's Advanced Auditing-related cluster parameters (`server_audit_logging`, `server_audit_events`, `server_audit_incl_users`, `server_audit_excl_users`), the CloudWatch Logs export configuration, and the public specifications of `describe-db-log-files` / `download-db-log-file-portion`. Figures for the performance impact or recording-volume increase from enabling auditing are not given because they are environment-dependent.

よくある質問

Where is the audit log configured?

In the DB cluster parameter group. You configure `server_audit_logging`, `server_audit_events`, `server_audit_incl_users`, and `server_audit_excl_users`. These are not in the instance-level DB parameter group, so you won't find them there.

Can this be run in production?

Checking the settings and retrieving logs are read-only and can be done in production as well. Enabling auditing is a cluster-wide configuration change that increases recording volume and affects write processing, so narrow the scope and go through change management first.

How much does performance drop after enabling the audit log?

No single figure can be given, because the impact depends on the event types recorded, SQL execution frequency, and instance class. Apply a load equivalent to production in a test environment and use the measured values with and without auditing as the basis for your decision.

How is this different from the slow query log?

The purpose differs. The slow query log records "which SQL was slow" and is used for performance investigation. The audit log records "who did what and when" and is used for traceability and accountability. A fast SQL statement can still be an audit target, and a slow one may not be.

What permissions are required?

Reading the settings requires only a connection privilege. Changing parameters requires IAM `rds:ModifyDBClusterParameterGroup`; configuring CloudWatch Logs export requires `rds:ModifyDBCluster`; retrieving logs requires `rds:DescribeDBLogFiles` and `rds:DownloadDBLogFilePortion`.

How can I reduce the recording volume?

The basic approach is to exclude `QUERY` and `QUERY_DML` from `server_audit_events` and limit it to CONNECT, QUERY_DDL, and QUERY_DCL. In addition, exclude monitoring accounts via `server_audit_excl_users`. However, since excluded operations are not recorded, decide based on your audit requirements.

この文書がカバーする質問

  • Want to find out who deleted a table in Aurora MySQL
  • Want to export RDS's audit log to CloudWatch Logs
  • Want to know the difference between the audit log and the general / slow query logs
  • Want to know how to reduce the audit log recording volume

リスク表示の意味

  • 参照のみデータと設定を変更しません。
  • 影響は限定的ですが、権限と負荷の確認が必要です。
  • 性能・ロック・コストに影響する可能性があります。
  • 障害・データ損失・復旧作業が発生する可能性があります。
  • 専門家レビュー必須本番適用前に別途レビューが必須です。

GIIPの対応範囲

The audit log is a system where "starting to collect it" is easier than "keeping it collected and readable when needed." GIIP periodically cross-checks whether the audit configuration has drifted from its intended state, and manages the log volume trend together with the log group retention period. Events worth detecting — such as granting privileges or dropping a table — are routed to notifications, with an AI agent performing the initial check after a notification, while a human decides whether a response is actually needed.

執筆・技術検証

GIIP プロダクション運用チーム

大規模Webサービス、SQL Server、Oracle、AWS、Azureの設計・移行・運用に約30年従事。x12largeクラスのAWS RDS for SQL Server環境12セット、約12万テーブルのOracle環境、約3TBのTiDBからAurora MySQLへの移行を経験。現在も複数のクラウドデータベースと約30のWebサービスを、AIエージェントと人間の専門家が継続的に監視・運用しています。

関連するナレッジ

関連サービス

Design an audit log retention and review workflow

同じ確認を複数の環境で継続する必要がある場合は、運用体制ごと相談できます。

Design an audit log retention and review workflow

ナレッジベース一覧へ