{"id":9586,"date":"2019-03-28T15:40:52","date_gmt":"2019-03-28T15:40:52","guid":{"rendered":"https:\/\/www.microsoft.com\/en-gb\/industry\/blog\/?p=9586"},"modified":"2019-10-07T09:27:58","modified_gmt":"2019-10-07T08:27:58","slug":"azure-log-analytics-looking-at-data-and-costs","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-gb\/industry\/blog\/cross-industry\/2019\/03\/28\/azure-log-analytics-looking-at-data-and-costs\/","title":{"rendered":"Azure Log Analytics: Looking at data and costs"},"content":{"rendered":"
At some stage, you either need to add a new set of data to Log Analytics or even look at your usage and costs.\u00a0Originally you looked at the Usage<\/strong> table for this data:<\/p>\n As you can see from these docs (and please read them as I wont go over the content here), Usage<\/strong> and some of the queries have moved to a new method using Union<\/strong>.<\/p>\n In this first example I take the sum of all bytes sent to all solutions. I have commented out the _IsBillable<\/strong> line as I wanted to show both data types.<\/p>\n A customer this week asked which solutions were free, this shows you that detail (after you have collected some data of course).\u00a0However if you don’t have the data, you can check within the public Demo Log Analytics workspace<\/a>.<\/p>\n TIP<\/strong>: This can be a good place to check, if the solution is chargeable before you add it to your own!\u00a0 or use this to gauge the likely data quantity. Also see Christoph Petersen’s blog on Data volume estimation for Log Analytics<\/a>.\u00a0<\/em><\/p>\n <\/p>\n <\/p>\n <\/p>\n You could then use this list to identify just one solution to drill into:<\/p>\n <\/p>\n <\/p>\n This last example builds on the last query, and looks at just the NetworkSecurityGroup<\/strong> (NSG) resources.<\/p>\n <\/p>\n <\/p>\n\n
Here are a few of my own that use this new technique<\/h2>\n
\/\/MBytes sent to Log Analytics by ALL solutions\/Tables\r\nunion withsource = tt *\r\n\/\/| where _IsBillable == true\r\n| summarize MBytes=round(sum(_BilledSize\/1024\/1024),2)\u00a0 by\u00a0 Solution=tt\u00a0 , _IsBillable\r\n| sort by MBytes nulls last<\/pre>\n
let SolutionName= \"AzureDiagnostics\";\r\nunion withsource = tt *\r\n| where TimeGenerated > ago(1d)\r\n| where _IsBillable == true\r\n| where tt == SolutionName\r\n| summarize MBytes=round(sum(_BilledSize\/1024\/1024),2) by Solution=tt , _IsBillable\r\n| sort by MBytes nulls last<\/pre>\n
union withsource = tt *\r\n| where TimeGenerated > ago(1d)\r\n| where _IsBillable == true\r\n| where tt == \"AzureDiagnostics\" and ResourceType==\"NETWORKSECURITYGROUPS\"\r\n| summarize MBytes=round(sum(_BilledSize\/1024\/1024),2) by Solution=tt , _IsBillable ,Resource\r\n| sort by MBytes nulls last<\/pre>\n