How to Fix MongoDB Error 344 (AuditingNotEnabled)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mongodb error 344 when you run an audit action while auditing is off. To fix this AuditingNotEnabled failure, turn on database auditing or stop sending audit commands. Database teams often see this message during security reviews or cluster updates. A script or monitoring tool tries to read or change audit rules. If the server runs without an active audit system, it rejects the request right away. What causes mongodb error 344 in your cluster MongoDB tracks internal failures with cle

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 get mongodb error 344 when you run an audit action while auditing is off. To fix this AuditingNotEnabled failure, turn on database auditing or stop sending audit commands.

Database teams often see this message during security reviews or cluster updates. A script or monitoring tool tries to read or change audit rules. If the server runs without an active audit system, it rejects the request right away.

What causes mongodb error 344 in your cluster

MongoDB tracks internal failures with clear code numbers and names. Code 344 maps to the official AuditingNotEnabled error name inside the database engine. The engine throws this error when a client asks for an audit task.

This issue happens for a few common reasons in live clusters. First, a team member might run an audit check on a test server. Test servers often have auditing turned off to save disk space and speed.

Second, a new node might join a cluster with the wrong startup settings. If one node lacks the audit setup, requests sent to that node will fail. Your app or script will then stop and report code 344.

Third, automated security tools might scan all your databases on a daily timer. When the scanner hits a server without auditing, the database returns this error code. The server works fine, but it cannot process the audit request.

How to diagnose and fix the failure in production

Start by checking which client or script sent the failed command. Look at your server logs to find the exact time and user account. This tells you if a person or an automated tool triggered the problem.

Next, decide if the database actually needs native auditing turned on. If the cluster holds non-sensitive test data, you might not need server-level audit logs. In that case, remove the server from your security scanner list to stop the error.

If the server holds production data, you must turn on auditing in the setup. Update the server settings so the audit system starts when the database boots. Plan a safe maintenance window if your setup requires a node restart.

MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

In a multi-node cluster, roll out the change one node at a time. Start with the secondary nodes before you step down and update the primary node. This careful approach keeps your app online while you fix the settings.

Once auditing is active, check the user permissions for the account running the checks. Do not grant full admin rights just to clear an error message. MongoDB grants access through role-based rules that apply to a specific database.

A role grants permission to run sets of actions on defined resources. It can grant access down to a single collection level of detail. Keep your monitoring and admin roles narrow so each user has only needed rights.

How to keep roles safe while fixing audit issues

When engineers debug errors like AuditingNotEnabled, they often ask for broad database roles. Giving out wide write access during an incident creates a major security risk. Instead, separate data reading tasks from system setup tasks across your team.

For regular data checks, use the built-in read role on the target database. The read role gives read access to all non-system collections in that database. It allows safe actions like finding records, listing collections, and checking index stats.

The read role does not allow users to insert, update, remove, or drop collections. If a developer needs to change records, the readWrite role adds those write actions. It lets users create collections and indexes without giving them server admin power.

Keep in mind that cloud users and self-hosted users have different built-in roles. Still, both models build their roles from the exact same set of basic actions. Always match the user role to the exact job they need to run.

By pairing proper audit settings with tight roles, you stop code 344 for good. Your security scripts will run without errors, and your data will stay safe.

Add command guardrails and field masking beside MongoDB

Collection roles and IP rules control who connects to MongoDB. Yet an active client or agent session can still run a pipeline that writes data or reads raw personal fields. In practice, hoop.dev sits inline in the wire protocol beside your database as a sidecar for your MongoDB. For every command an agent or human sends in production, hoop.dev decides to pass, mask, block, or escalate it for review.

Using hoop.dev MongoDB controls, guardrails refuse banned commands before they run or hold risky calls for approval, and data masking rewrites matched fields in returned documents in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for GDPR, HIPAA, and PCI DSS programs. View the project on GitHub.

Frequently asked questions

What does MongoDB error code 344 mean?

Error code 344 means AuditingNotEnabled in the database engine. It happens when a user or tool runs an audit command while auditing is turned off.

Does mongodb error 344 stop normal read and write queries?

No, this error only blocks commands that try to use the audit system. Regular app queries that read or write data will keep working as normal.

Can I fix this error by giving my user the readWrite role?

No, adding data roles like read or readWrite will not fix this error. You must turn on auditing in the server setup or stop sending audit commands.

The query runs. The emails stay hidden.