Thursday, 24 September 2020

Kusto convert unix timestamp to datetime format

 

Example: Unix time

Unix time (also known as POSIX time or UNIX Epoch time) is a system for describing a point in time as the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

If your data includes representation of Unix time as an integer, or you require converting to it, the following functions are available:

Kusto
let fromUnixTime = (t:long)
{ 
    datetime(1970-01-01) + t * 1sec 
};
print result = fromUnixTime(1546897531)
EXAMPLE: UNIX TIME
result
2019-01-07 21:45:31.0000000
Kusto
let toUnixTime = (dt:datetime) 
{ 
    (dt - datetime(1970-01-01)) / 1s 
};
print result = toUnixTime(datetime(2019-01-07 21:45:31.0000000))
TABLE 2
result
1546897531


from : https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/datetime-timespan-arithmetic

Friday, 4 September 2020

How can I see the rowcounts for tables in a log analytics workspace?

 The following query returns table names and row counts for all tables with at least one row for the time range selected.

union withsource=sourceTable *
| project sourceTable
| summarize count() by sourceTable


from : https://stackoverflow.com/questions/56706816/how-can-i-see-the-rowcounts-for-tables-in-a-log-analytics-workspace

Python - Get invocation id in azure function

After finding the  right part in the documentation  it was surprisingly easy: def main ( mytimer: func.TimerRequest, context: func.Context ...