Advertisement
ymoon1972

Kusto Query

Mar 9th, 2022 (edited)
167
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://cpim.kusto.windows.net
  2.  
  3. // Detect invalid DCs
  4. | extend DC = iff(env_cloud_location == "<null>", extract("PROD-(.*?)-0*", 1, env_cloud_name), env_cloud_location)
  5.  
  6. // Find all role instances
  7. IfxRequestEvent
  8. | where env_time > ago(1d)
  9. | where env_cloud_role == "TPEngine"
  10. | where env_cloud_location == "AM3"
  11. | extend instance = substring(env_cloud_roleInstance, 0, 3)
  12. | summarize count() by instance
  13.  
  14. // Find # of running tasks from Redis Timeout log.
  15. let Start = datetime({startTime});
  16. let End = datetime({endTime});
  17. IfxRedisRequestEvent
  18. | where env_time between (Start .. End)
  19. | where role == "TPEngine"
  20. | where env_cloud_location == "AM3"
  21. | where env_cloud_roleInstance == "AM4PEPF0001615B"
  22. | where isSynthetic == false
  23. | where resultSignature == "StackExchange.Redis.RedisTimeoutException"
  24. | extend BusyCount = toint(extract_all("Busy=(\\d+),", resultDescription)[1])
  25. | extend start_time = datetime_add("millisecond", -durationMs, env_time)
  26. | summarize CpuTask=avg(BusyCount) by bin(start_time, 1m)
  27.  
  28. // Find # of tasks from IfxRequest logs.
  29. union Ifx*
  30. | where env_time between (datetime("2022-03-18T05:00:00.000Z") .. datetime("2022-03-18T10:00:00.000Z"))
  31. | where role == "TPEngine"
  32. | where env_cloud_location == "AM3"
  33. | where env_cloud_roleInstance == "AM4PEPF0001615B"
  34. | summarize TPEngineTask=dcount(threadId_uint16) by bin(env_time, 1m)
  35. | render timechart
  36.  
  37. // Getting performance counter
  38. let Start = datetime({startTime});
  39. let End = datetime({endTime});
  40. let InstanceToFind = split("{CDBInstance}", ",")[0];
  41. CounterEvent
  42. | where TIMESTAMP between (Start .. End)
  43. | where Role == "TPEngine"
  44. | where DataCenter == "{CDBDataCenter}"
  45. | where CounterName == "\\Processor(_Total)\\% Processor Time"
  46. | where substring(RoleInstance, 0, 3) == InstanceToFind
  47. | summarize max(CounterValue) by RoleInstance, bin(TIMESTAMP, {TimeDiv})
Advertisement
RAW Paste Data Copied
Advertisement