question

MuhamedSalihSI avatar image
0 Votes"
MuhamedSalihSI asked MuhamedSalihSI edited

correlationID

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-functionsazure-api-managementazure-cosmos-db
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SeyedibrahimMuhamedsalihETWCogniza-3751, Thank you for reaching out. I am currently working on the issue faced, I will share my updates soon.

1 Vote 1 ·
MuhamedSalihSI avatar image MuhamedSalihSI ChaitanyaNaykodiMSFT-9638 ·

awaiting for your response @ChaitanyaNaykodiMSFT-9638

0 Votes 0 ·
ChaitanyaNaykodiMSFT-9638 avatar image
0 Votes"
ChaitanyaNaykodiMSFT-9638 answered ChaitanyaNaykodiMSFT-9638 edited

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MuhamedSalihSI avatar image
0 Votes"
MuhamedSalihSI answered ChaitanyaNaykodiMSFT-9638 commented

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 - @ChaitanyaNaykodiMSFT-9638

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @MuhamedSalihSI. Sure, please let me know if any further concerns.

0 Votes 0 ·
WaelKdouh-2778 avatar image
0 Votes"
WaelKdouh-2778 answered MuhamedSalihSI edited

Any update on implementing this feature?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

anonymous user,

The log's correlation I have achieved via using app insights service and respective SDK in Azure Env.
if you're using nodeJS, check out this lib: https://www.npmjs.com/package/applicationinsights

0 Votes 0 ·