normalian blog

Let's talk about Microsoft Azure, ASP.NET and Java!

How to utilize monitoring for container apps on Service Fabric clusters with Log Analytics - part 2: log types

Refer to an article below before following this post to setup Log Analytics for Service Fabric clusters.
You can learn how to execute simple queries on Log Analytics to retrieve Service Fabric clusters metrics.

I believe you have already setup your Service Fabric cluster with your container apps and Log Analytics. Open your Log Analytics and choose "Log Search" item. Next, execute "search *" command like below then you can take all types of logs stored into your Log Analytics.

You can find several types of logs such like "Perf", "ContainerImageInventory", "ContainerInventory", "Heartbeat" and "Usage". According to Container Monitoring solution in Azure Log Analytics | Microsoft Docs, we can understand which metrics we can take. Next, let's dig into each log types exept for Usage, because the type is used for Log Analytics usage.

"Perf" type

In this type, you can retrieve Processor Time, Memory Usage, network usage, Disk usage including container applications.
At first, you retrieve Service Fabric cluster nodes metrics specifying ObjectName as necessary metrics like below.

search *| where Type == "Perf“
| where ObjectName == "Processor“
| where CounterName == "% Processor Time“
| where CounterValue > 25

You can find query result like below.

next, retrieve container apps metrics on Service Fabric cluster by executing log search query below and you can retrieve container apps metrics.

search *
| where Type == "Perf“
| where ObjectName == "Container“
| where CounterName == "% Processor Time“
| where CounterValue > 2

Note the query is specified "Container“ as ObjectName and CounterName which metrics is needed.

We can really dig into this log type in lots of perspectives. I will follow that in future.

"ContainerImageInventory" type

You can retrieve which repositories, images, tags, image sizes and nodes are used to deploy your container apps like below.

"ContainerInventory" type

In this type, you can retrieve TimeGenerated, Computer, container name, ContainerHostname, Image, ImageTag, ContainerState, ExitCode, EnvironmentVar, Command, CreatedTime, StartedTime, FinishedTime, SourceSystem, ContainerID, and ImageID like below.

You can monitor container apps life cycle using this log type using ContainerState, TimeGenerated, CreatedTime, StartedTime and FinishedTime like below.