|
| 1 | +--- |
| 2 | +title: Manage file access logs in Azure NetApp Files |
| 3 | +description: File access logs provide file access logging for individual volumes, capturing file system operations on selected volume |
| 4 | +services: azure-netapp-files |
| 5 | +author: b-ahibbard |
| 6 | +ms.service: azure-netapp-files |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 04/01/2025 |
| 9 | +ms.author: anfdocs |
| 10 | +ms.custom: references_regions |
| 11 | +--- |
| 12 | + |
| 13 | +# Manage file access logs in Azure NetApp Files (preview) |
| 14 | + |
| 15 | +File access logs provide file access logging for individual volumes, capturing file system operations on selected volumes. The logs capture [standard file operation](#recognized-events). File access logs provide insights beyond the platform logging captured in the [Azure Activity Log](/azure/azure-monitor/essentials/activity-log). |
| 16 | + |
| 17 | +## Considerations |
| 18 | + |
| 19 | +>[!IMPORTANT] |
| 20 | +>The file access logs feature is only supported with SMB3, NFSv4.1, and dual-protocol volumes. It's not supported on NFSv3 volumes. |
| 21 | +
|
| 22 | +* Once file access logs are enabled on a volume, they can take up to 75 minutes to become visible. |
| 23 | +* Each log entry consumes approximately 1 KB of space. |
| 24 | +* File access logs occasionally create duplicate log entries that must be filtered manually. |
| 25 | +* Deleting any diagnostic settings configured for `ANFFileAccess` causes any file access logs for any volume with that setting to become disabled. See the [diagnostic setting configuration](#diagnostic) for more information. |
| 26 | +* Before enabling file access logs on a volume, either [access control lists (ACLs)](configure-access-control-lists.md) or Audit access control entries (ACEs) need to be set on a file or directory. You must set ACLs or Audit ACEs after mounting a volume. |
| 27 | +* File access logs provide no explicit or implicit expectations or guarantees around logging for auditing and compliance purposes. |
| 28 | + |
| 29 | +### Performance considerations |
| 30 | + |
| 31 | +* All file access log file access events have a performance impact. |
| 32 | + * Events such as file/folder creation or deletion are key events to log. |
| 33 | + * System access control list (SACL) settings for logging should be used sparingly. Frequent operations (for example, READ or GET) can have significant performance impact, but have limited logging value. It's recommended that SACL setting not log these frequent operations to conserve performance. |
| 34 | + * SACL policy additions aren't currently supported with file access logs. |
| 35 | +* When clubbing events such as READ/WRITE, only a handful of operation per file read or write are captured to reduce event logging rate. |
| 36 | +* File access logs support a [log generation rate metric](azure-netapp-files-metrics.md). The log generation rate shouldn't exceed 64 MiB/minute. |
| 37 | + |
| 38 | + If the rate of file access event generation exceeds 64 MiB/minute, the [Activity log](monitor-azure-netapp-files.md) sends a message stating that the rate of file access log generation is exceeding the limit. If log generation exceeds the limit, logging events can be delayed or dropped. If you're approaching this limit, disable noncritical auditing ACLs to reduce the event generation rate. As a precaution, you can [create an alert](/azure/azure-monitor/alerts/alerts-create-activity-log-alert-rule) for this event. |
| 39 | + |
| 40 | +* During migration or robocopy operations, disable file access logs to reduce log generation. |
| 41 | +* It's recommended you avoid enabling file access logs on files with more than 450 ACEs to avoid performance issues. |
| 42 | + |
| 43 | +## Recognized events |
| 44 | + |
| 45 | +The events capture in file access logs depend on the protocol of your volume. |
| 46 | + |
| 47 | +### Logged NFS events |
| 48 | +* Close |
| 49 | +* Create |
| 50 | +* Get attributes |
| 51 | +* Link |
| 52 | +* `Nverify` |
| 53 | +* Open |
| 54 | +* Open attribute |
| 55 | +* Remove |
| 56 | +* Rename |
| 57 | +* Set attribute |
| 58 | +* Verify |
| 59 | +* Write |
| 60 | + |
| 61 | +### Logged SMB events |
| 62 | +* Create |
| 63 | +* Delete |
| 64 | +* Get attributes |
| 65 | +* Hard link |
| 66 | +* Open object |
| 67 | +* Open object with the intent to delete |
| 68 | +* Read |
| 69 | +* Rename |
| 70 | +* Set attribute |
| 71 | +* Unlink |
| 72 | +* Write |
| 73 | + |
| 74 | +## Register the feature |
| 75 | + |
| 76 | +The file access logs feature is currently in preview. If you're using this feature for the first time, you need to register the feature first. |
| 77 | + |
| 78 | +1. Register the feature: |
| 79 | + |
| 80 | + ```azurepowershell-interactive |
| 81 | + Register-AzProviderFeature -ProviderNamespace Microsoft.NetApp -FeatureName ANFFileAccessLogs |
| 82 | + ``` |
| 83 | +
|
| 84 | +1. Check the status of the registration: |
| 85 | +
|
| 86 | + > [!NOTE] |
| 87 | + > The **RegistrationState** can be in the `Registering` state for up to 60 minutes before changing to`Registered`. Wait until the status is **Registered** before continuing. |
| 88 | +
|
| 89 | + ```azurepowershell-interactive |
| 90 | + Get-AzProviderFeature -ProviderNamespace Microsoft.NetApp -FeatureName ANFFileAccessLogs` |
| 91 | + ``` |
| 92 | +
|
| 93 | +You can also use [Azure CLI commands](/cli/azure/feature) `az feature register` and `az feature show` to register the feature and display the registration status. |
| 94 | +
|
| 95 | +## Supported regions |
| 96 | +
|
| 97 | +Availability for file access log is limited to the following regions: |
| 98 | +
|
| 99 | +- Australia Central |
| 100 | +- Australia East |
| 101 | +- Australia Southeast |
| 102 | +- Brazil South |
| 103 | +- Canada Central |
| 104 | +- Canada East |
| 105 | +- Central India |
| 106 | +- Central US |
| 107 | +- East US |
| 108 | +- East US 2 |
| 109 | +- Japan West |
| 110 | +- North Europe |
| 111 | +- South Central US |
| 112 | +- Switzerland North |
| 113 | +- Switzerland West |
| 114 | +- UK South |
| 115 | +- US Gov Virginia |
| 116 | +- West Europe |
| 117 | +- West US |
| 118 | +- West US 2 |
| 119 | +
|
| 120 | +## Set SACLs or Audit ACEs on files and directories |
| 121 | +
|
| 122 | +You must set SACLs for SMB shares or Audit ACEs for NFSv4.1 exports for auditing. |
| 123 | +
|
| 124 | +### [Set SACLs for SMB shares](#tab/sacls-smb) |
| 125 | +
|
| 126 | +If you're logging access events on all files and directories within a volume, set SACLs by applying Storage-Level Access Guard security. |
| 127 | +
|
| 128 | +>[!NOTE] |
| 129 | +> Select only the events you need to log. Selecting too many log options can impact system performance. |
| 130 | +
|
| 131 | +To enable logging access on individual files and directories, complete the following steps on the Windows administration host. |
| 132 | +
|
| 133 | +#### Steps |
| 134 | +
|
| 135 | +To enable logging access on individual files and directories, complete the following steps on the Windows administration host. |
| 136 | +
|
| 137 | +1. Select the file or directory for which to enable logging access. |
| 138 | +1. Right-click the file or directory, then select **Properties**. |
| 139 | +1. Select the **Security** tab then **Advanced**. |
| 140 | +1. Select the **Auditing** tab. Add, edit, or remove the auditing options you want. |
| 141 | +
|
| 142 | +
|
| 143 | +### [Set Audit ACEs for NFSv4.1 shares](#tab/sacls-nfs) |
| 144 | +
|
| 145 | +For NFSv4.1, both discretionary and system ACEs are stored in the same ACL, not separate discretionary ACLs and SACLs. Exercise caution when adding audit ACEs to an existing ACL to avoid overwriting and losing an existing ACL. The order in which you add audit ACEs to an existing ACL doesn't matter. |
| 146 | +
|
| 147 | +**For steps**, see [Configure access control lists on NFSv4.1 volumes](configure-access-control-lists.md). |
| 148 | +
|
| 149 | +--- |
| 150 | +
|
| 151 | +## Enable file access logs |
| 152 | +
|
| 153 | +1. In the **Volumes** menu, select the volume you want to enable file access logs for. |
| 154 | +1. Select **Diagnostic settings** from the left-hand pane. |
| 155 | +1. Select **+ Add diagnostic setting**. |
| 156 | +:::image type="content" source="./media/manage-file-access-logs/logs-diagnostic-settings-add.png" alt-text="Screenshot of Azure Diagnostic settings menu."::: |
| 157 | +1. <a name="diagnostic"></a> In the **Diagnostic setting** page, provide a diagnostic setting name. |
| 158 | + Under **Logs > Categories**, select **ANFFileAccess** then set the retention period of the logs. |
| 159 | +:::image type="content" source="./media/manage-file-access-logs/logs-diagnostic-settings-enable.png" alt-text="Screenshot of Azure Diagnostic settings menu with file access diagnostic setting."::: |
| 160 | +1. Select one of the destination options for the logs: |
| 161 | + * Archive to a storage account |
| 162 | + * Stream to an event hub |
| 163 | + * Send to Log Analytics workplace |
| 164 | + * Send to a partner solution |
| 165 | +1. Save the settings. |
| 166 | +
|
| 167 | +## Disable file access logs |
| 168 | +
|
| 169 | +1. In the **Volumes** menu, select the volume on which you want to disable file access logs. |
| 170 | +2. Select the **Diagnostic setting** menu from the left-hand pane. |
| 171 | +3. In the **Diagnostic settings** page, deselect **Audit**. This automatically deselects **ANFFileAccess**. |
| 172 | +4. Select **Save**. |
| 173 | +
|
| 174 | +>[!NOTE] |
| 175 | +>After disabling file access logs, you must wait at least ten minutes before attempting to enable or re-enable file access logs on any volume. |
| 176 | + |
| 177 | +## Next Steps |
| 178 | +
|
| 179 | +* [Security FAQs](faq-security.md) |
| 180 | +* [Azure resource logs](/azure/azure-monitor/essentials/resource-logs) |
| 181 | +* [Understand NFSv4.x access control lists in Azure NetApp Files](nfs-access-control-lists.md) |
| 182 | +* [Understand SMB file permissions in Azure NetApp Files](network-attached-file-permissions-smb.md) |
0 commit comments