Search code examples
azurekubernetesloggingstream

Stream Azure container logging to web app


I wish to extend my web app's functionality with the possibility to show the results of a custom Azure logging query like this:

let apiIds = KubePodInventory
    | where ServiceName == "my-service-name"
    | distinct ContainerID;
ContainerLog
| where ContainerID in (apiIds)
    and LogEntry contains ("my custom query")
| order by TimeGenerated desc 
| project TimeGenerated, LogEntry

A great addition would be to have live logging also.

However, I have no idea where to get started. Is there somebody with (good/bad) experience with this idea?


Solution

  • (as discussed in the comments)

    You can use the Azure Monitor Query SDK in your app https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/monitor/Azure.Monitor.Query