Display custom container insights logs on asp.net website using c#

Pavani Kadambari 1 Reputation point
2022-05-12T15:06:19.197+00:00

Hi

I have requirement like i need to display logs for custom query in container logs(Kubernetes service) azure kub for c#

Please help me with any documentation or article. I can see documents on application insights but not on azure logs.

custom query like below

KubePodInventory
| where Namespace contains "monitor"
| join
(
ContainerLog
)
on ContainerID
| project TimeOfCommand, LogEntry, LogEntrySource, PodLabel, ContainerID, Namespace
| where LogEntry contains "keyword"
| order by TimeOfCommand desc

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 13,161 Reputation points Moderator
    2022-05-17T01:07:39.577+00:00

    @Pavani Kadambari - Welcome to Microsoft Q&A and thanks for reaching out.

    If you would like to query from azure log analytics, when you click on monitor from the azure sidebar it gives you the option of container insights & your log analytics resources. Presumably you’d query from those.

    For more information on the same, please take a look at this document for more information: container-insights-log-query

    UPDATE:

    In general for ContainerLog, we use below for querying:

    205211-image.png

    205079-image.png

    And this will generate query scoped to that container.

    You might also want to look into this doc which provides more information on configuring Application Insights for your ASP.NET Website : asp-net

    If you need more information, can you please provide the requested details?

    • What is the desired output of the query ?
    • what are the events/outputs ?

    Hope this helps. and please feel free to reach out if you have any further questions.

    ------------------------------------------------------------------

    If the above response was helpful, please feel free to "Accept as Answer" and "Upvote" the same so it can be beneficial to the community.


Your answer

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