Skip to content

Native database audit logs

This guide lists, per database engine and platform, which native audit logs QubeSight can read with a built-in parser, how to turn the audit on in the database, and how to ship the log to QubeSight. Use it when you monitor databases directly instead of, or in addition to, Guardium.

Community Enterprise

Filebeat and syslog are available in both editions. The cloud paths (Azure Event Hub, AWS Kinesis, AWS CloudWatch Logs) require Enterprise.

Support matrix

"Built-in" means QubeSight parses the records without any rule. "Teach the format" means the log can be sent over syslog, and you create a parse rule once with the wizard (see Add a new data source).

Engine Platform Audit source Path Parser
MongoDB Enterprise Self-hosted Native audit log (auditLog, JSON) Filebeat → Kafka Built-in
Couchbase Server Enterprise Self-hosted Native audit log, including N1QL statements Filebeat → Kafka Built-in
PostgreSQL Azure flexible server pgaudit in PostgreSQLLogs Event Hub Built-in
PostgreSQL Amazon RDS pgaudit in the PostgreSQL log CloudWatch Logs (direct or Kinesis) Built-in
Aurora PostgreSQL AWS Database Activity Streams Kinesis Built-in
MySQL Azure flexible server MySqlAuditLogs Event Hub Built-in
MySQL / MariaDB Amazon RDS MariaDB audit plugin CloudWatch Logs (direct or Kinesis) Built-in
Aurora MySQL AWS Database Activity Streams Kinesis Built-in
SQL Server Azure SQL Database Server audit to Event Hub Event Hub Built-in
SQL Server Azure SQL Managed Instance SQLSecurityAuditEvents Event Hub Built-in
SQL Server Amazon RDS for SQL Server Database Activity Streams Kinesis Built-in
Oracle Amazon RDS for Oracle Database Activity Streams (unified audit) Kinesis Built-in
Cosmos DB for MongoDB (RU and vCore) Azure MongoRequests / vCoreMongoRequests Event Hub Built-in
Cosmos DB for NoSQL Azure DataPlaneRequests, QueryRuntimeStatistics Event Hub Built-in
PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and others Self-hosted Any audit log the database or its host can send as syslog Syslog TCP 5140 Teach the format
Any engine monitored by Guardium Any Guardium SNMP, syslog, archive Built-in, see Guardium overview

Not supported in 2.0.110: Oracle Database@Azure, Amazon DocumentDB and MongoDB Atlas. The New Integration wizard under Stream Sources → Guardium shows a Native DB Audit card marked Coming Soon; it cannot be selected. Native audit logs are connected through the paths in the table above, not through that card.

Prerequisites

Before you turn on a native audit log, make sure that:

  • Edition. Filebeat and syslog work in both editions. Azure Event Hub, AWS Kinesis and AWS CloudWatch Logs need an Enterprise licence (or the marketplace trial).
  • Role. You have the QubeSight admin role (integrations and the allowlist are changed by administrators only), and administrative rights on the database or the cloud account to change its audit settings.
  • Database edition. The engine edition supports native auditing: MongoDB Enterprise and Couchbase Server Enterprise for the self-hosted Filebeat path; pgaudit available for PostgreSQL; the audit plugin or server audit for MySQL, MariaDB and SQL Server.
  • Network.
    • Filebeat path: the database host reaches the QubeSight Kafka endpoint (TCP 9092, or the cluster's virtual IP ports; 9093 with ingest TLS) and has the Kafka credentials shown on the Filebeat tab.
    • Syslog path: the host reaches TCP 5140 (or 6514 with ingest TLS on a cluster), and its address is on the Access allowlist (Syslog/SNMP) when enforcement is on.
    • Cloud paths: QubeSight reaches the Event Hubs namespace on TCP 9093, or the AWS Kinesis, CloudWatch Logs and KMS APIs over HTTPS, with the permissions listed on Azure Event Hub, AWS Kinesis and AWS CloudWatch Logs.
  • Volume. You have estimated the audit volume. Enabling statement-level auditing can add load on the database and, for cloud sources, cost for Event Hubs throughput units, Kinesis shards or CloudWatch Logs ingestion.
  • Clock. The database host's clock is synchronised (NTP); events are stored with their own event time.

Self-hosted MongoDB Enterprise

Native auditing is a MongoDB Enterprise feature.

  1. Add to /etc/mongod.conf:

    auditLog:
      destination: file
      format: JSON
      path: /var/log/mongodb/audit.json
    setParameter:
      auditAuthorizationSuccess: true
    
  2. Restart MongoDB: systemctl restart mongod.

  3. Install Filebeat on the database host and use the configuration from Data Sources → Stream Sources → Filebeat (MongoDB). See Filebeat and Kafka ingest.

QubeSight parses authentication and query, write and DDL events. Mongo shell-style commands are classified by QubeSight's MongoDB classifier (for example driver heartbeats as administrative commands, $out and $merge aggregations as writes).

Self-hosted Couchbase Server Enterprise

Auditing is a Couchbase Enterprise feature.

  1. Enable auditing:

    /opt/couchbase/bin/couchbase-cli setting-audit -c localhost -u Administrator -p <password> --enable 1
    
  2. For N1QL statements with their text, make sure the query events (28672 and above: SELECT, INSERT, UPDATE, DELETE) are not disabled in the audit settings.

  3. Install Filebeat and use the Couchbase configuration from Data Sources → Stream Sources → Filebeat. The default audit file is /opt/couchbase/var/lib/couchbase/logs/audit.log.

QubeSight parses the statement, bucket and user information and the query duration.

Azure managed databases

Configure a diagnostic setting (or, for Azure SQL Database, the server audit) that writes to an Event Hub, and add the hub in QubeSight. Engine-specific settings:

  • Azure SQL Database: server audit to Event Hub with the default action groups (batch completed, successful and failed database authentication).
  • Azure SQL Managed Instance: diagnostic category SQLSecurityAuditEvents, plus a server audit TO EXTERNAL_MONITOR with the batch-completed and login groups.
  • PostgreSQL flexible server: pgaudit enabled, log_connections = on, and the recommended log_line_prefix %t:%r:%u@%d:[%p]:. With the default prefix the user, database and client address are empty.
  • MySQL flexible server: audit_log_enabled = ON, audit_log_events = CONNECTION,GENERAL (optionally TABLE_ACCESS).
  • Cosmos DB: enable full-text query logging to receive query text.

The full steps, field behaviour and known limits are in Azure Event Hub.

AWS managed databases

  • Aurora PostgreSQL / MySQL, RDS for Oracle, RDS for SQL Server: start a Database Activity Stream (asynchronous mode) with a customer-managed KMS key, and add the aws-rds-das-<resource-id> stream in QubeSight. For Oracle and SQL Server, create the audit policies before starting the stream. See AWS Kinesis and Database Activity Streams.
  • RDS for MySQL / MariaDB: add the MARIADB_AUDIT_PLUGIN option (SERVER_AUDIT_EVENTS = CONNECT,QUERY) and export the audit log to CloudWatch Logs.
  • RDS for PostgreSQL: load pgaudit, set pgaudit.log, keep the default RDS log_line_prefix, run CREATE EXTENSION pgaudit;, and export the postgresql log.

Read the exported log groups directly (AWS CloudWatch Logs) or through a Kinesis subscription (AWS Kinesis).

Other self-hosted databases (syslog)

For PostgreSQL (pgaudit), MySQL and MariaDB (audit plugins), SQL Server, Oracle and other engines running on your own servers, QubeSight has no built-in syslog parser. Send the audit log as syslog and teach the format once:

  1. Configure the database to write its audit records to the system log, or configure the host's syslog daemon (rsyslog, syslog-ng) to read the audit file and forward it over TCP to <qubesight-address>:5140.
  2. Add the host to Data Sources → Stream Sources → Access allowlist (Syslog/SNMP).
  3. Generate activity. The lines arrive in Platform → Pipeline → Parsing → Unrecognized logs (not stored).
  4. Teach the format with Let me select the fields or the New rule wizard: set a scope (text every line of this source carries), map the user, client address, database and statement to DB user, Client IP, Database name and SQL, and tick the option to process the queued lines.

The wizard reads JSON, key=value, CEF, delimited and free-text (regular expression) bodies behind an RFC 3164 or RFC 5424 syslog header.

Verification

For every path, run a short scripted test on the database: a successful login, a failed login (wrong password), one CREATE TABLE, one INSERT, one SELECT and one failing statement. Then check the general places:

  1. Platform → Pipeline → Flow with Last hour: the lines appear as read and stored, not under Unrecognized.
  2. Platform → Pipeline → Parsing → Built-in parsers: the parser of the path (for example Filebeat (MongoDB / Couchbase), Azure Event Hub, AWS Kinesis or AWS CloudWatch Logs) shows a count for the last 24 hours and a recent Last line.
  3. Platform → Pipeline → Diagnostics → Recent lines: the parsed fields (DB user, client IP, database, SQL) are filled.
  4. Reports: the full SQL report filtered by the server shows each test statement once, the failed login as failed and the failing statement with its error.
  5. In Enterprise, Data Sources → Source Health lists the server.

Then check the path-specific points:

Engine and path Check that auditing is on Check in QubeSight
MongoDB Enterprise (Filebeat) db.adminCommand({getCmdLineOpts: 1}) shows auditLog; the audit file grows Stream Sources → Filebeat: the host is under Detected sources and Total events grows. Authentication and find/insert commands appear in Reports.
Couchbase Server Enterprise (Filebeat) couchbase-cli setting-audit … --get-settings shows auditing enabled; audit.log grows Filebeat tab as above; a N1QL SELECT appears with its statement text and bucket.
Azure SQL Database, SQL Managed Instance, PostgreSQL / MySQL flexible server, Cosmos DB (Event Hub) In the Azure portal the diagnostic setting (or server audit) targets the hub; the hub's incoming messages metric rises Stream Sources → Event Hub: Events Received and Last Event move. Allow for Azure's own delivery delay (up to several minutes; see Azure Event Hub). For PostgreSQL, the user, database and client address are filled only with the recommended log_line_prefix.
Aurora PostgreSQL / MySQL, RDS for Oracle, RDS for SQL Server (Database Activity Streams) aws rds describe-db-clusters (or describe-db-instances) shows the activity stream as started Stream Sources → AWS Kinesis: Test decrypts a record, and the status line shows records decrypted and events written.
RDS for MySQL / MariaDB, RDS for PostgreSQL (CloudWatch Logs) The log group /aws/rds/instance/<db>/audit (or /postgresql) receives new log streams Stream Sources → AWS CloudWatch Logs: Test reports the group as readable; its Cursor advances and Events grows (or, through Kinesis, the Kinesis card counters move).
Self-hosted engines over syslog The host's syslog daemon forwards the audit file (check its own log for connection errors) Before you teach the format, the lines appear in Unrecognized logs; after the rule is saved and the queue processed, they are counted under Your rules in Flow and appear in Reports.

Limitations

  • Statement duration and row counts are not in every audit log (PostgreSQL and MySQL audit logs do not carry them; SQL Server, Azure SQL, Cosmos DB and Aurora MySQL activity streams do). Add the slow-operation log to fill them: Slow-operation logs.
  • Self-hosted engines over syslog depend on your parse rule; QubeSight does not ship a syslog parser for them in 2.0.110.
  • RDS for Oracle and RDS for SQL Server activity streams were tested with scripted sessions only; long-running maintenance by the AWS-managed users has not been observed.