How to Configure MariaDB Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up the mariadb audit log by turning on the built-in server audit plugin. Then you choose which database events to write to your log files. Most teams start by turning on all events in the main database settings file. When roles are too broad, a single shared login hides who ran each query. You see the database account in the log, not the person at the keyboard. How the mariadb audit log works The database includes a native plugin that watches activity inside the server engine. Admins

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up the mariadb audit log by turning on the built-in server audit plugin. Then you choose which database events to write to your log files. Most teams start by turning on all events in the main database settings file. When roles are too broad, a single shared login hides who ran each query. You see the database account in the log, not the person at the keyboard.

How the mariadb audit log works

The database includes a native plugin that watches activity inside the server engine. Admins load this plugin at startup or turn it on during a live session. Once active, the plugin checks every action against your chosen filter rules. You can record login attempts, queries, and table changes across the server. You can also filter events by specific database users so service accounts stay quiet.

The plugin sends these records to a local file or the system log. When you use a local file, the server manages file size through rotation settings. Old files roll over when they hit your size limit, keeping disks from filling. Teams often ship these local files to a central log tool for review. This setup keeps a running record of what happened on the database host.

Choosing which database events to record

Recording every single query on a busy server creates massive log files fast. High write volume can slow down disk speed and hurt your main app. Teams split events into clear groups before turning the plugin on. Tracking logins and failed password tries gives you a baseline with low disk cost. You catch brute force attempts and spot stale app accounts right away.

For query tracking, you can split schema changes from everyday data reads and writes. Schema changes should always go into the log because they alter table structure. Data reads and writes need more care on high-traffic databases. Many teams only log data queries for human admin accounts, skipping standard app roles. This balance keeps log files small while still watching manual database work.

Audit Log Integrity + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Where native database logging falls short

The native plugin solves basic history tracking, but it only acts after queries finish. It cannot stop a bad drop statement or pause a risky update in flight. If an engineer logs in with a shared role, the log only shows that role. You lose the link between the SQL statement and the person who ran it. Fixing an incident takes much longer when everyone shares one admin user.

Native logs also write raw query text straight to the host disk. If a query filters by email or card number, that data sits in plain text. Anyone who can read the server log files can see those sensitive values. And when someone runs a broad select query, the plugin does not mask results. Phone numbers and national IDs flow back to the client screen untouched.

Inspect every MySQL query and response in flight

Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.

First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.

Frequently asked questions

Does the MariaDB audit plugin require a server restart?

No, you can load the plugin during a live session without stopping the database. You still need to update the settings file so it stays on after reboots.

Where does MariaDB store its audit records?

You can send records to a dedicated file inside the data folder. You can also route them to the local system log for central collection.

Can the native audit log block dangerous SQL queries?

No, the native plugin only writes down events after the database runs them. It does not block queries, require peer review, or rewrite sensitive fields in results.

The query runs. The emails stay hidden.