SQL Audit sent a event log of windows

Accounts Payable Auditor

Configuring SQL Audit for Windows Event Logging

Hello everyone,

I have successfully set up SQL auditing to log events in Windows Security. Here’s a step-by-step guide on how to do it:

  1. Local Policy Configuration:
    Navigate to Local Policies -> User Rights Assignment and add the service user NT SERVICE\MSSQLSERVER to the “Generate security audits” property.

  2. Registry Permissions:
    Grant NT SERVICE\MSSQLSERVER full control permissions in the Windows Registry for the following paths:

  3. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog
  4. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security

  5. Set Audit Policies:
    Open an elevated Command Prompt and run the following command to enable auditing:
    auditpol /set /subcategory:"application generated" /success:enable /failure:enable

  6. Restart the Server:
    After making these changes, restart your server to apply them.

  7. Modify Registry for Windows 2016 and Later:
    If you’re using Windows Server 2016 or later, change the EventSourceFlags registry value from 0 to 1 at the following path:

  8. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security\MSSQLSERVER

After these steps, you can configure the events to be audited within SQL Server, either at the instance or database level. This setup captures a variety of events, not just logon and logoff activity, but also changes to permissions, user roles, and more.

Important Note: Be mindful that SQL auditing can generate a large volume of events, especially if applications are running. It is advisable to enable auditing for a short period and then reduce it accordingly.

Hope this helps!

Tags:

Categories:

One response

  1. Your step-by-step guide for configuring SQL Server Audit logging to Windows Event Security logs is clear and well-structured! Here’s a brief response to acknowledge the helpfulness of your instructions and to emphasize some points:


    Thank you for sharing this comprehensive guide on configuring SQL Server audits via Windows Event Security logs!

    1. User Rights Assignment: Properly configuring user rights is crucial, and you’ve clearly outlined the steps to assign the NT SERVICE\MSSQLSERVER user account.

    2. Registry Permissions: Granting full control permissions to the necessary registry keys is a critical step that is often overlooked. Your detail on where to do this will surely help others.

    3. Audit Policy: Using the command line to manage Audit policies is efficient and straightforward. Ensuring both success and failure auditing is enabled provides a complete picture of activities.

    4. Server Restart: A reminder to restart the server is essential since changes to policies and configurations won’t take effect until then.

    5. EventSourceFlags Change: Highlighting the difference in requirements for Windows 2016 onwards is a great touch; it’s an important detail for administrators running on newer versions.

    Your note about temporarily activating SQL audits to avoid excessive event logging is also valuable, as it helps prevent performance issues during active operations.

    This will undoubtedly aid many in ensuring proper auditing without overwhelming their systems. Keep up the great work!


    Feel free to adapt any part of this response to add your personal touch!

Leave a Reply