Forum Discussion
alchem_rj
Sep 01, 2020Tin Contributor
Table count from custom log
Hello, I would like to get the count of table name reference in my custom log which is pushed to the Log analytics. The custom log structure is given below. 020-08-31 16:15:38 ProxyEngine [I...
Noa Kuperberg
Microsoft
Sep 01, 2020Hi alchem_rj,
You can use "parse-where" like I did here. The short syntax is
...| parse-where LogText with * "from " table_name
| summarize count() by table_name
where LogText is the name of the field you analyze.
The command is documented here.
- alchem_rjSep 03, 2020Tin Contributor
Thanks a lot, Noa Kuperberg for the suggestion
- alchem_rjSep 03, 2020Tin Contributor
Hi Noa Kuperberg ,
One more help is it possible to filter count based on the month using
the bin(TimeGenerated, 30day) will help?Tablename July count August Count table_1 3 2 table_2 2 10 - Noa KuperbergSep 06, 2020
Microsoft
alchem_rj yes, but it will be displayed a bit differently. Easiest is to just add a month column - Run this to play with it (I'm assuming the datetime information is ingested to the TimeGenerated field, which is typically what happens). The query text is:
... | parse-where LogText with * "from " table_name | extend month=getmonth(TimeGenerated) | summarize count() by month, table_nameand in ithis case the results would be:
month table_name count_ 8 table_1 2 8 table_2 1 To create a column for each month, append "| evaluate pivot(month)" to the query and you'll get:
table_name count_ 8 7 table_1 2 1 ... table_2 1 1 ... Of course with more data you'll have additional columns for the other months.