Updated on 2024-06-11 GMT+08:00

Creating a Database Audit Task

Scenarios

You want to check whether database objects for audit meet specifications and affect performance

Prerequisites

A data source has been created and connected successfully.

Constraints

  • The audited database objects can only be tables, views, sequences, indexes, functions, procedures, triggers, or packages.
  • A maximum of 10,000 schemas can be audited at a time.
  • During the database audit, do not delete database objects that are being audited, or audit results may be affected.
  • If a system template is used, the audit results before and after a version upgrade will be inconsistent. You are advised to use a custom template.

Procedure

  1. Log in to the UGO console.
  2. In the navigation pane on the left, choose SQL Audit > Database Audit.
  3. Click Create Audit Task.

    Figure 1 Creating an audit task
    Table 1 Parameter description

    Parameter

    Description

    Task Name

    Enter a task name, which is mandatory.

    The name must contain 5 to 50 characters, start with a letter, and end with a digit or letter. Only letters (case-insensitive), digits, underscores (_) are allowed.

    Database Type

    Select a database type. Only the GaussDB database is supported. This parameter is mandatory.

    Data Source

    Select a data source. Currently, only GaussDB data sources are supported. This parameter is mandatory.

    If there is no available data source, click Create Data Source.

    Schema

    Select a schema. This parameter is optional and only available for GaussDB databases.

    • If this parameter is not specified, all schemas are audited by default. However, up to 10,000 schemas can be audited.
    • If the parameter is specified, you can select up to 10,000 schemas.

    Rule Template

    Select a system template or custom template.

    You can set the template information by referring to Adding a Rule Template.

    Description

    Add the description of the task. The description can contain up to 100 characters. This parameter is optional.

  4. Click OK and view the file task you created on the task list page.

    Figure 2 Audit task list

    The task status can be:

    • Pending: The database audit task is to be scheduled.
    • Collecting objects: SQL statements scanned in the database and DDL statements in the schema of a specified database.
    • Auditing SQL statements: The database is being audited.
    • Audit completed: The database audit is complete only after all database objects are audited.
    • Audit failed: An exception occurred during the audit.

    If the audit task is terminated due to UGO restart during the creation of the audit task, you can click Retry. If the audit task is terminated during the object collection phase, the system deletes the collected objects and connects to the database again after the retry. If the audit task is terminated during the object audit phase, the audit continues after the retry.