|
| 1 | +--- |
| 2 | +title: How to manage audit logs for Microsoft Azure Data Manager for Energy Preview |
| 3 | +description: Learn how to use audit logs on Azure Data Manager for Energy Preview |
| 4 | +author: sandeepchads |
| 5 | +ms.author: sancha |
| 6 | +ms.service: energy-data-services |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 04/11/2023 |
| 9 | +ms.custom: template-how-to |
| 10 | +#Customer intent: As a developer, I want to use audit logs to check audit trail for data plane APIs for Azure Data Manager for Energy Preview. |
| 11 | +--- |
| 12 | + |
| 13 | + |
| 14 | +# Manage audit logs |
| 15 | +Audit logs provide auditing trails for data plane APIs on Azure Data Manager for Energy. With audit logs, you can tell: |
| 16 | +* Who performed an action |
| 17 | +* What was the action |
| 18 | +* When was the action performed |
| 19 | +* Status of the action |
| 20 | + |
| 21 | +For example, when you “Add a new member” to the ```users.datalake.admins``` entitlement group using entitlements API, you're able to see this information in audit logs. |
| 22 | + |
| 23 | +[](media/how-to-manage-audit-logs/how-to-manage-audit-logs-4-entilements.png#lightbox) |
| 24 | + |
| 25 | +## Enable audit logs |
| 26 | +To enable audit logs in diagnostic logging, select your Azure Data Manager for Energy instance in the Azure portal. |
| 27 | +* Select the **Activity log** screen, and then select **Diagnostic settings**. |
| 28 | +* Select **+ Add diagnostic setting**. |
| 29 | +* Enter the Diagnostic settings name. |
| 30 | +* Select **Audit Events** as the Category. |
| 31 | + |
| 32 | +[](media/how-to-manage-audit-logs/how-to-manage-audit-logs-1-audit-event-diagnostic-logs.png#lightbox) |
| 33 | + |
| 34 | +* Select appropriate Destination details for accessing the diagnostic logs. |
| 35 | + |
| 36 | +> [!NOTE] |
| 37 | +> It might take up to 15 minutes for the first Logs to show in Log Analytics. |
| 38 | +For information on how to work with diagnostic logs, see [Azure Resource Log documentation.](../azure-monitor/essentials/platform-logs-overview.md) |
| 39 | + |
| 40 | +## Audit log details |
| 41 | +The audit logs for Azure Data Manager for Energy service returns the following fields. |
| 42 | + |
| 43 | +|Field Name| Type| Description| |
| 44 | +|----------|----------|----------------| |
| 45 | +| TenantID | String | The tenant of your Azure Data Manager for Energy instance.| |
| 46 | +| TimeGenerated | UTC format | The time of the audit log. | |
| 47 | +| Category | String | The diagnostic settings category to which the logs belong.| |
| 48 | +| Location | string | Location of the Azure Data Manager for Energy resource. | |
| 49 | +| ServiceName | String | Name of OSDU service running in Azure Data Manager for Energy. For example: Partition, Search, Indexer, Legal, Entitlements, Workflow, Register, Unit, Crs-catalog, File, Schema, and Dataset | |
| 50 | +| OperationName | String |Operation ID or operation name associated to data plane APIs, which emits audit logs for example "Add member" | |
| 51 | +| Data partition ID | String | Data partition ID on which operation is performed. | |
| 52 | +| Action | String | Action refers to the type of operation that is, whether it's create, delete, update etc.| |
| 53 | +| ActionID | String | ID associated with operation. | |
| 54 | +| PuID | String | ObjectId of the user in Azure AD| |
| 55 | +| ResultType | String | Define success or failure of operation | |
| 56 | +| Operation Description | String | Provides specific details of the response. These details can include tracing information, such as the symptoms, of the result that are used for further analysis. | |
| 57 | +| RequestId | String | This is the unique ID associated to the request, which triggered the operation on data plane. | |
| 58 | +| Message | String | Provides message associated with the success or failure of the operation.| |
| 59 | +| ResourceID | String | The Azure Data Manager for Energy resource ID of the customer under which the audit log belongs. | |
| 60 | + |
| 61 | +## Sample queries |
| 62 | + |
| 63 | +Basic Application Insights queries you can use to explore your log data. |
| 64 | + |
| 65 | +1. Run the following query to group operations by ServiceName: |
| 66 | + |
| 67 | +```sql |
| 68 | +OEPAuditLogs |
| 69 | +| summarize count() by ServiceName |
| 70 | +``` |
| 71 | + |
| 72 | +[](media/how-to-manage-audit-logs/how-to-manage-audit-logs-3-allservices.png#lightbox) |
| 73 | + |
| 74 | +2. Run the following query to see the 100 most recent logs: |
| 75 | + |
| 76 | +```sql |
| 77 | +OEPAuditLogs |
| 78 | +| limit 100 |
| 79 | +``` |
| 80 | + |
| 81 | +3. Run the following query to get all the failed results: |
| 82 | + |
| 83 | +```sql |
| 84 | +OEPAuditLogs |
| 85 | +| where ResultType contains "Failure" |
| 86 | +``` |
| 87 | + |
| 88 | + |
| 89 | +## Next steps |
| 90 | + |
| 91 | +Learn about Managed Identity: |
| 92 | +> [!div class="nextstepaction"] |
| 93 | +> [Managed Identity in Azure Data Manager for Energy Preview](how-to-use-managed-identity.md) |
| 94 | +
|
| 95 | + |
0 commit comments