correlationID

MuhamedSalihSI 71 Reputation points
2021-01-11T21:26:59.567+00:00

I am using azure functions , APIM and cosmos db(SDK).
and I am using log analytics to trace the logs.

when I am trying to correlation the apim logs, azure functions logs and cosmosdb logs

  1. I find that cosmosdb logs have correlation id (under Azure Diagnostics & metric tables) but how to populate it via sdk I need assistance?
  2. from log analytics I cant able to access custom log message of azure functions?
  3. FunctionAppLogs does not have correlation id how can I correlate functions log with apim and cosmosdb?

If its address I can correlate the traces of multiple component.

Thank in advance

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,260 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,332 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,726 questions
{count} votes

Accepted answer
  1. ChaitanyaNaykodi-MSFT 26,951 Reputation points Microsoft Employee
    2021-01-20T01:16:07.937+00:00

    Hello @SeyedibrahimMuhamedsalihETWCogniza-3751, my sincere apologies for the delay. I will try and address the questions as mentioned above in order.

    I find that cosmosdb logs have correlation id (under Azure Diagnostics & metric tables) but how to populate it via sdk I need assistance?

    As mentioned in the Stackoverflow post made by you, I think this is not possible.

    from log analytics I cant able to access custom log message of azure functions?

    If you have followed this documentation to configure log analytics for your function app, the custom logs do get populated, but there is some delay when you initially configure it (I had to wait aprox. 30-40 mins) before the logs started appearing after this logs were uploaded instantly. You can find the custom user generated logs under the Category - "Function.<HttpTriggerName>.User". In application insights these type of logs are generated as trace item type.

    FunctionAppLogs does not have correlation id how can I correlate functions log with apim and cosmosdb?

    Yes you are correct Function App logs in Log analytics do not have correlation_id, alternatively you can leverage Application insights for correlating the logs. According to the documentation Application Insights supports distributed telemetry correlation. To associate telemetry with a logical operation, every telemetry item has a context field called operation_Id. This identifier is shared by every telemetry item in the distributed trace.

    For Http triggered Function App some of the distributed tracings are tracked automatically. Using the operation_id mentioned above you can the find the logs related to APIM and Cosmos Db under "dependency" item type. For configuration of application insights you can follow the documentation for Function App and APIM.

    Please let me know if there are any concerns, I will be glad to continue with our discussion.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. MuhamedSalihSI 71 Reputation points
    2021-01-21T04:48:18.547+00:00

    I am glad to see my stack overflow post referenced here.
    and looking at the answers I shall accept it for now and shall try to implement it.
    I will revert and comment in this thread, if I face any issues in implementations.

    Thanks - @ChaitanyaNaykodi-MSFT


  2. Wael Kdouh 1 Reputation point Microsoft Employee
    2021-10-27T16:50:38.307+00:00

    Any update on implementing this feature?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.