|
| 1 | +--- |
| 2 | +title: Diagnostics logs for Hybrid Connections |
| 3 | +description: This article provides an overview of all the activity and diagnostics logs that are available for Azure Relay. |
| 4 | +services: service-bus-messaging |
| 5 | +author: spelluru |
| 6 | +editor: |
| 7 | + |
| 8 | +ms.assetid: |
| 9 | +ms.service: service-bus-relay |
| 10 | +ms.devlang: na |
| 11 | +ms.topic: how-to |
| 12 | +ms.tgt_pltfrm: na |
| 13 | +ms.date: 04/27/2020 |
| 14 | +ms.author: spelluru |
| 15 | + |
| 16 | +--- |
| 17 | +# Enable diagnostics logs for Azure Relay Hybrid Connections |
| 18 | +When you start using your Azure Relay Hybrid Connections, you might want to monitor how and when your listeners and senders are opened and closed, and how your Hybrid Connections are created and messages are sent. This article provides an overview of activity and diagnostics logs provided by the Azure Relay service. |
| 19 | + |
| 20 | +You can view two types of logs for Azure Relay: |
| 21 | + |
| 22 | +- [Activity logs](../azure-monitor/platform/platform-logs-overview.md): These logs have information about operations performed against your namespace in the Azure portal or through Azure Resource Manager template. These logs are always enabled. For example: "Create or update namespace", "Create or update hybrid connection". |
| 23 | +- [Diagnostic logs](../azure-monitor/platform/platform-logs-overview.md): You can configure diagnostic logs for a richer view of everything that happens with operations and actions that are conducted against your namespace by using the API, or through language SDK. |
| 24 | + |
| 25 | +## View activity logs |
| 26 | +To view activity logs for your Azure Relay namespace, switch to the **Activity log** page in the Azure portal. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +## Enable diagnostic logs |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> Diagnostic logs are available only for Hybrid Connections, not for Windows Communication Foundation (WCF) Relay. |
| 34 | +
|
| 35 | +To enable diagnostics logs, do the following steps: |
| 36 | + |
| 37 | +1. In the [Azure portal](https://portal.azure.com), go to your Azure Relay namespace and then, under **Monitoring**, select **Diagnostic settings**. |
| 38 | +1. On the **Diagnostics settings** page, select **Add diagnostic setting**. |
| 39 | + |
| 40 | +  |
| 41 | + |
| 42 | +1. Configure the diagnostics settings by doing the following steps: |
| 43 | + 1. In the **Name** box, enter a name for the diagnostics settings. |
| 44 | + 2. Select **HybridConnectionsEvent** for the type of log. |
| 45 | + 3. Select one of the following three **destinations** for your diagnostics logs: |
| 46 | + 1. If you select **Archive to a storage account**, configure the storage account where the diagnostics logs will be stored. |
| 47 | + 2. If you select **Stream to an event hub**, configure the event hub that you want to stream the diagnostics logs to. |
| 48 | + 3. If you select **Send to Log Analytics**, specify which instance of Log Analytics the diagnostics will be sent to. |
| 49 | + |
| 50 | +  |
| 51 | +1. Select **Save** on the toolbar to save the settings. |
| 52 | + |
| 53 | +The new settings take effect in about 10 minutes. The logs are displayed in the configured archival target, in the **Diagnostics logs** pane. For more information about configuring diagnostics settings, see the [overview of Azure diagnostics logs](../azure-monitor/platform/diagnostic-logs-overview.md). |
| 54 | + |
| 55 | + |
| 56 | +## Schema for hybrid connections events |
| 57 | +Hybrid connections event log JSON strings include the elements listed in the following table: |
| 58 | + |
| 59 | +| Name | Description | |
| 60 | +| ------- | ------- | |
| 61 | +| ResourceId | Azure Resource Manager resource ID | |
| 62 | +| ActivityId | Internal ID, used to identify the specified operation. May also be known as "TrackingId" | |
| 63 | +| Endpoint | The address of the Relay resource | |
| 64 | +| OperationName | The type of the Hybrid Connections operation that’s being logged | |
| 65 | +| EventTimeString | The UTC timestamp of the log record | |
| 66 | +| Message | The detailed message of the event | |
| 67 | +| Category | Category of the event. Currently, there is only `HybridConnectionsEvents`. |
| 68 | + |
| 69 | + |
| 70 | +## Sample hybrid connections event |
| 71 | +Here's a sample hybrid connections event in JSON format. |
| 72 | + |
| 73 | +```json |
| 74 | +{ |
| 75 | + "resourceId": "/SUBSCRIPTIONS/0000000000-0000-0000-0000-0000000000000/RESOURCEGROUPS/MyResourceGroup/PROVIDERS/MICROSOFT.RELAY/NAMESPACES/MyRelayNamespace", |
| 76 | + "ActivityId": "7006a0db-27eb-445c-939b-ce86133014cc", |
| 77 | + "endpoint": "sb://myrelaynamespace.servicebus.windows.net/myhybridconnection/7006a0db-27eb-445c-939b-ce86133014cc_G5", |
| 78 | + "operationName": "Microsoft.Relay/HybridConnections/NewSenderRegistering", |
| 79 | + "EventTimeString": "2020-04-27T20:27:57.3842810Z", |
| 80 | + "message": "A new sender is registering.", |
| 81 | + "category": "HybridConnectionsEvent" |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## Events and operations captured in diagnostic logs |
| 86 | + |
| 87 | +| Operation | Description | |
| 88 | +| --------- | ----------- | |
| 89 | +| AuthorizationFailed | Authorization failed.| |
| 90 | +| InvalidSasToken | Invalid SAS token. | |
| 91 | +| ListenerAcceptingConnection | The listener is accepting connection. | |
| 92 | +| ListenerAcceptingConnectionTimeout | The listener accepting connection has timed out. | |
| 93 | +| ListenerAcceptingHttpRequestFailed | The listener accepting HTTP request failed due to an exception. | |
| 94 | +| ListenerAcceptingRequestTimeout | The listener accepting request has timed out. | |
| 95 | +| ListenerClosingFromExpiredToken | The listener is closing because the security token has expired. | |
| 96 | +| ListenerRejectedConnection | The listener has rejected the connection. | |
| 97 | +| ListenerReturningHttpResponse | The listener is returning an HTTP response. | |
| 98 | +| ListenerReturningHttpResponseFailed | The listener is returning an HTTP response with a failure code. | |
| 99 | + ListenerSentHttpResponse | Relay service has received an HTTP response from the listener. | |
| 100 | +| ListenerUnregistered | The listener is unregistered. | |
| 101 | +| ListenerUnresponsive | The listener is unresponsive when returning a response. | |
| 102 | +| MessageSendingToListener | Message is being sent to listener. | |
| 103 | +| MessageSentToListener | Message is sent to listener. | |
| 104 | +| NewListenerRegistered | New listener registered. | |
| 105 | +| NewSenderRegistering | New sender is registering. | |
| 106 | +| ProcessingRequestFailed | The processing of a Hybrid Connection operation has failed. | |
| 107 | +| SenderConnectionClosed | The sender connection is closed. | |
| 108 | +| SenderListenerConnectionEstablished | The sender and listener established connection successfully. | |
| 109 | +| SenderSentHttpRequest | The sender sent an HTTP request. | |
| 110 | + |
| 111 | + |
| 112 | +## Next steps |
| 113 | + |
| 114 | +To learn more about Azure Relay, see: |
| 115 | + |
| 116 | +* [Introduction to Azure Relay](relay-what-is-it.md) |
| 117 | +* [Get started with Relay Hybrid Connections](relay-hybrid-connections-dotnet-get-started.md) |
0 commit comments