All Products
Search
Document Center

E-MapReduce:Audit logs

Last Updated:Mar 26, 2026

Audit logs record all SQL operations executed in your EMR Serverless StarRocks instance. The AuditLoader plugin reads logs from a local file and loads them into a StarRocks table, making them queryable through standard SQL—so you can investigate slow queries, trace errors, and audit user activity without external tooling.

Important

Do not delete the _starrocks_audit_db_ database or the starrocks_audit_tbl table. Deleting either prevents the SQL task query feature from working in StarRocks Manager.

How it works

StarRocks writes all audit log entries to a local file at fe/log/fe.audit.log. You cannot access these logs through the internal system database. The AuditLoader plugin reads this file and imports the entries into the starrocks_audit_tbl table in the _starrocks_audit_db_ database using the HTTP PUT method.

The audit log feature is enabled by default and cannot be disabled.

Constraints

  • Audit logs use dynamic partitioning. By default, the last 30 days of data are retained. To change the retention period, modify the dynamic_partition.start and dynamic_partition.end parameter values in the table properties.

View audit logs in StarRocks Manager

To locate the audit log database and table in the StarRocks Manager UI:

  1. Go to the Metadata Management page.

  2. In the Data Directory pane, expand default_catalog.

  3. Find the _starrocks_audit_db_ database and the starrocks_audit_tbl table.

Audit log database and table in StarRocks Manager

Query audit logs

To query audit logs, run SQL statements against the starrocks_audit_tbl table.

Example: Find slow queries from a specific user

SELECT queryId, timestamp, queryTime, stmt
FROM _starrocks_audit_db_.starrocks_audit_tbl
WHERE queryType = 'slow_query'
  AND user = 'root'
ORDER BY queryTime DESC
LIMIT 20;

Example: Check recent errors

SELECT queryId, timestamp, user, errorCode, errorMsg, stmt
FROM _starrocks_audit_db_.starrocks_audit_tbl
WHERE state = 'ERR'
ORDER BY timestamp DESC
LIMIT 20;

Audit log table schema

To view the full table creation statement, run:

SHOW CREATE TABLE starrocks_audit_tbl;

The starrocks_audit_tbl table uses the OLAP engine with queryId, timestamp, and queryTime as duplicate keys, partitioned by timestamp (range partitioning), and distributed by queryId across 3 buckets. The default storage uses LZ4 compression with a single replica.

Column reference

ColumnTypeDescription
queryIdvarchar(64)Unique ID of the query
timestampdatetimeTime when the query started
queryTimebigintQuery execution time, in milliseconds
queryTypevarchar(12)Query type: query (standard query), slow_query (query that exceeded the slow query threshold), or connection (connection event)
clientIpvarchar(32)IP address of the client
uservarchar(64)Username that ran the query
authorizedUservarchar(64)User identity in user_identity format, for example, 'root'@'%'
resourceGroupvarchar(64)Resource group used by the query
catalogvarchar(32)Data catalog where the query ran
dbvarchar(96)Database where the query ran
statevarchar(8)Query status: EOF (completed normally with results returned), ERR (failed with an error), or OK (succeeded without result rows)
errorCodevarchar(512)Error code, if the query failed
errorMsgvarchar(1048576)Error details, if the query failed
scanBytesbigintBytes scanned by the query
scanRowsbigintRows scanned by the query
returnRowsbigintRows returned by the query
cpuCostNsbigintCPU time consumed by the query, in nanoseconds
memCostBytesbigintMemory consumed by the query, in bytes
planCpuCostsdoubleCPU time consumed during query planning, in nanoseconds
planMemCostsdoubleMemory consumed during query planning, in bytes
pendingTimeMsbigintTime the query waited in the queue, in milliseconds
stmtIdintIncremental ID of the SQL statement
stmtTypevarchar(8)SQL statement type: DQL, DML, DDL, DCL, or OTHER
isQuerytinyintWhether the statement is a query: 1 (yes) or 0 (no)
isFiltertinyintWhether the statement was filtered by the AuditLoader filter condition: 1 (yes) or 0 (no)
feIpvarchar(128)IP address of the frontend (FE) node that executed the statement
stmtvarchar(1048576)Original SQL statement
digestvarchar(32)Fingerprint of the slow SQL statement
warehousevarchar(96)Compute group used by the query
candidateMVsvarchar(65533)List of candidate materialized views (MVs) considered for the query
hitMvsvarchar(65533)List of materialized views that the query hit