1. Home
  2. Azure Log Analytics – User Connection Logs

Azure Log Analytics – User Connection Logs

Below is the query to generate a list for a defined timeframe of user connections and the duration of the connection.

// Session duration by date 
// Lists users by session duration in the last 24 hours. 
// The "State" provides information on the connection stage of an actitivity.
// The delta between "Connected" and "Completed" provides the connection time for a specific connection.
WVDConnections 
| where TimeGenerated > ago(30d) 
| where State == "Connected" 
| project CorrelationId , UserName, ConnectionType , StartTime=TimeGenerated, Date=format_datetime(TimeGenerated, 'MM-dd-yyyy')
| join (WVDConnections 
 | where State == "Completed" 
 | project EndTime=TimeGenerated, CorrelationId) 
 on CorrelationId 
| project Date, Duration = EndTime - StartTime, ConnectionType, UserName 
| sort by Date desc

Leave a Comment