Satya Panigrahy
Satya Panigrahy

Reputation: 113

Azure APIM sending logs to EventHub( WebSocketConnection selected). How to set it up?

I am using one APIM resource with a back-end api(app service) connected. Here is the whole setup I did to read the data from eventhub which is sent from the app service through APIM.

  1. Setup App Service and connect it to APIM.

  2. In Diagnostic Settings of APIM, select the EventHub you want to send the logs. Select the option 'WebSocketConnectionLogs'.

  3. Create an Azure function to read the data from EventHub through EventHub Trigger.

    Now that I am aware of 'log-to-event' policy for this, but my company is not using that. They have asked me to setup according to the above process. I did that, but the function is not picking anything. Is there anything I am missing here?Any help would be great.

Upvotes: 0

Views: 500

Answers (1)

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4786

  1. Setup App Service and connect it to APIM.
  1. In Diagnostic Settings of APIM, select the EventHub you want to send the logs. Select the option 'WebSocketConnectionLogs'.

I hope you already done the first 2 steps. But while sending the messages to event hub from APIM we have some limitations. As per the MSDOC,

The maximum supported message size that can be sent to an event hub from this API Management policy is 200 kilobytes (KB). If a message that is sent to an event hub is larger than 200 KB, it will be automatically truncated, and the truncated message will be transferred to event hubs.

  1. Create an Azure function to read the data from EventHub through EventHub Trigger.

In the third step you have to use the Azure Event Hub output binding / Azure Event Hub Triggers in an Azure Function we must have the read access to the underlying event hub to set up trigger. Refer MSDOC for more information.

Upvotes: 1

Related Questions