Search code examples
azurekqlazure-log-analytics

KQL - Query Usage Time who only shows me the Results between 08:00 and 17:00 Time


i have a Question about a Query in KQL. I would like to use a Time at the KQL Query who only shows me the Results between 08:00 and 17:00 Time.

How can i build these at the KQL Query? Im only find the DateTime Variable but i need only the Time?

Thanks a lot.

Regards, Phil


Solution

  • The below is the example to show logs between specific time:

    let start=datetime("10/26/2022 1:04:27.627 AM");
    let end=datetime("10/26/2022 1:22:53.745 AM");
    traces
    | where timestamp > start and timestamp < end 
    

    enter image description here

    If you only want timestamp then:

    let start=datetime("10/26/2022 1:04:27.627 AM");
    let end=datetime("10/26/2022 1:22:53.745 AM");
    traces
    | where  timestamp > start and timestamp < end 
    | project timestamp
    

    enter image description here

    You can give your date and time in end and start in query.