Is there a way to ingest logs about custom data from APIM to log analytics workspace?

Smruti Ranjan Nayak 81 Reputation points Microsoft Employee
2024-03-28T09:58:58.9133333+00:00

Hi team,

I would like to know if there is a way to ingest custom logs from APIM to log analytics workspace other than what's already being ingested?

Thanks:)

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,751 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 21,171 Reputation points
    2024-03-28T10:51:59.4666667+00:00

    @Smruti Ranjan Nayak Thanks for reaching out. As Ben mentioned custom logging would be through Event Hubs.

    To ingest custom logs from APIM to a Log Analytics workspace, you can follow these steps:

    1. Create a custom log in APIM. You can do this by adding a log-to-eventhub policy to your API or operation policy. This policy sends log data to an Azure Event Hub, which can then be ingested into a Log Analytics workspace. https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-log-event-hubs#log-to-event-hub-policy
    2. Create an Azure Event Hub.
    3. Configure the Azure Event Hub to send data to the Log Analytics workspace. You can do this by creating a diagnostic setting for the Event Hub and configuring it to send data to the Log Analytics workspace.https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings#create-a-diagnostic-setting
    4. Verify that the custom logs are being ingested into the Log Analytics workspace. https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-overview

    I hope this helps and let me know if any questions.

    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.