question

PavaniKadambari-4489 avatar image
0 Votes"
PavaniKadambari-4489 asked vipullag-MSFT edited

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

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
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.

1 Answer

Monalla-MSFT avatar image
0 Votes"
Monalla-MSFT answered Monalla-MSFT commented

@PavaniKadambari-4489 - 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.



image.png (538.1 KiB)
image.png (328.4 KiB)
· 4
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.

Hi Monalla

please note I can check logs from azure container. I want to display them on my asp.net website can you please help on same.

0 Votes 0 ·
Monalla-MSFT avatar image Monalla-MSFT PavaniKadambari-4489 ·

@PavaniKadambari-4489 - Thanks for sharing more details. Let me take a look into it in detail and get back to you as soon as possible. Thank you.

0 Votes 0 ·
Monalla-MSFT avatar image Monalla-MSFT PavaniKadambari-4489 ·

@PavaniKadambari-4489 - I have provided an updated answer above. Please take a look at it and see if that helps.

0 Votes 0 ·
Monalla-MSFT avatar image Monalla-MSFT PavaniKadambari-4489 ·

@PavaniKadambari-4489 - Did the below answer help resolve your issue, if not please revert back with any questions.
and if it did, please feel free to "accept as answer" so it can be beneficial to the community.

0 Votes 0 ·