You can query audit logs to view requests within a specific period of time, and use filter conditions to filter the requests.

Prerequisites

Activate Log Service

Background information

You can query audit logs for detailed insight when you want to view database request records, discover the cause for sudden increases in Redis resource consumption, or find records of modify and delete operations on data.

View audit logs

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar, select the region where the instance is located.
  3. In the left-side navigation pane, click Instances to go to the Instances page. Find the target instance. Click the instance ID, or click the More icon and select Manage in the Action column.
  4. In the left-side navigation pane of the Instance Information page, choose Logs > Audit Logs.
  5. The Audit Logs page displays audit log information for the ApsaraDB for Redis instance.

Filter audit logs

You can define different conditions to filter audit logs.

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar, select the region where the instance is located.
  3. In the left-side navigation pane, click Instances to go to the Instances page. Find the target instance. Click the instance ID, or click the More icon and select Manage in the Action column.
  4. In the left-side navigation pane of the Instance Information page, choose Logs > Audit Logs.
  5. On the Audit Logs page, you can define conditions to filter audit logs.
    Set filter conditions
    Table 1. Filter conditions
    Filter condition Description
    Keyword Filters audit logs by keywords such as the client IP address, executed commands, accounts, and extended information.
    Note
    • The Keyword filed uses exact match, so you must enter complete information.
      • For example, you must enter a complete IP address such as 192.168.1.1, instead of 192.168 or 1.1.
      • You must enter a complete command such as AUTH or auth, instead of au.
    • You must enclose keywords that contain colons within double quotation marks (""), such as "userId:1".
    Type The type of audit logs. Valid values:
    • redis_audit_log indicates the audit log of a data shard.
    • redis_proxy_audit_log indicates the audit log of a proxy server.
    Account The account used to connect the ApsaraDB for Redis instance. Null is displayed by default.
    Client ip The client IP address used to connect the ApsaraDB for Redis instance.
    DB Displays the audit logs generated within a specified database.

View audit logs within a specified time range

You can view audit logs within a specified time range by using the time picker.

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar, select the region where the instance is located.
  3. In the left-side navigation pane, click Instances to go to the Instances page. Find the target instance. Click the instance ID, or click the More icon and select Manage in the Action column.
  4. In the left-side navigation pane of the Instance Information page, choose Logs > Audit Logs.
  5. On the Audit Logs page, click Please Select.
    Click the time picker
  6. Specify the time range in the time picker.
    Set the time picker
    Table 2. Time picker sections
    No. Section Description
    1 Time Information about the time range is displayed in this section when you move the pointer over a relative time or a time frame.
    2 Relative A time period relative to the current point in time. Information about the time range is displayed in the Time section when you move the pointer over any element in this section.
    2 Time Frame A time frame period that is more than one minute in length. Information about the time range is displayed in the Time section when you move the pointer over any element in this section.
    4 Custom A custom time period. Specify a time period and click OK to confirm the time period.