Skip to content

Audit Logging

Only in DbVisualizer Pro

This feature is only available in the DbVisualizer Pro edition.

DbVisualizer can log the SQL statements it executes, its metadata queries and changes to the connection state, such as commits. Use the audit log to meet security policies and regulations, to investigate incidents, to see which statements were run against a database, or for debugging. The log files are structured, so you can collect them in a central repository.

The audit log only records what is done through DbVisualizer. Use it together with the auditing of the database, not instead of it.

Enabling audit logging

In Tools → Tool Properties, select the General / Audit Log category, and select Enable Audit Log. You can also select:

  • Log Metadata Queries, such as listing the tables of a schema. This gives many more entries.
  • Log Connection State Changes, such as commit, rollback and changing the current database or schema.

Log file location

The audit log files are in the logs/audit folder of the workspace, by default ~/.dbvis/logs/audit/. They are named dbvis-audit-YYYYMMDD-<u>-<g>.log, where:

  • YYYYMMDD is the UTC date the file was created.
  • <u> is a number that keeps several running DbVisualizer instances from writing to the same file.
  • <g> is 0 for the current file. When a file reaches its maximum size, a new file is started, and the older files get higher numbers.

A new file is started each day and when a file reaches 10 MB. Files are removed after 5 days. You can change both limits; see Setting audit logging for all users.

Log entry format

Each line in a log file is a JSON object:

{"ts":"2026-04-29T08:11:50.123Z","type":"SQL","sessionId":"wVjPq3Nf4kXnBsRa7yQ8c","cmd":"SELECT id, name FROM users WHERE active = 1","connection":{"id":"abc123","url":"jdbc:mysql://localhost:3306/","ssh":"dbvisuser@203.0.113.10:22"},"database":"sys"}

The fields are:

FieldTypeDescription
tsStringUTC timestamp with millisecond precision (ISO-8601 format).
typeStringThe type of activity: SQL, META, or CONN.
sessionIdStringA stable, unique identifier for the specific JDBC connection lifetime.
cmdStringThe executed SQL statement, metadata method name, or connection-state method.
argsArrayMethod arguments (applicable to META and CONN entries; omitted for SQL).
connectionObjectContains the internal connection id, the masked JDBC url, and any active ssh tunnel chains.
database / schemaStringThe active catalog and schema context at the time of execution (omitted if not applicable).
countIntegerPresent if identical, consecutive entries were combined during a single write cycle.

Sensitive data masking

To protect credentials, DbVisualizer masks them in the log:

  • In database URLs, the values of sensitive parameters, such as token or password, are masked.
  • In SQL statements, passwords in common commands are masked, for example ALTER USER ... IDENTIFIED BY '***'. This depends on the database type; for the Generic type, SQL statements aren't masked.

The masking doesn't catch every case. Treat the audit log as sensitive information.

Setting audit logging for all users

Administrators can set audit logging for all users with these properties in dbvis-custom.prefs. The check boxes that are set this way can't be changed in Tool Properties. The retention period, the maximum file size and the folder are read when DbVisualizer starts.

PropertyDescription
dbvis.auditLog.enabledEnable audit log
dbvis.auditLog.logMetadataLog metadata queries
dbvis.auditLog.logConnectionChangesLog connection state changes
dbvis.-auditLog.retentionDaysRetention period
dbvis.-auditLog.maxFileSizeBytesMax file size
dbvis.-auditLog.directoryAudit log directory

For example, to turn audit logging on without metadata queries, keep the files for 30 days, and write them to another folder:

dbvis.auditLog.enabled=true
dbvis.auditLog.logMetadata=false
dbvis.auditLog.logConnectionChanges=true
dbvis.-auditLog.retentionDays=30
dbvis.-auditLog.directory=/var/log/dbvisualizer