【问题标题】:Kusto query to exclude results from a certain time (Ex. Thursday from midnight-2am EST)Kusto 查询以排除特定时间的结果(例如,星期四从美国东部标准时间午夜到凌晨 2 点)
【发布时间】:2022-01-19 17:23:41
【问题描述】:

我是 KQL 的新手,我正在尝试针对对扩展名为“.config”的文件所做的配置更改编写查询,并希望删除在“TimeGenerated [UTC]”列下生成的结果。 结果应不包括星期四从美国东部标准时间午夜到凌晨 2 点。有人能帮我写这个吗?不知道如何编写它以使其返回排除特定时间范围的结果。以下是我目前所拥有的:

ConfigurationChange
| where ConfigChangeType in("Files")
| where FileSystemPath contains ".config"
| sort by TimeGenerated
| render table

【问题讨论】:

  • 今天再次运行查询时,似乎不排除星期四从午夜到凌晨 2 点的时间范围。有什么想法吗?以下是我所拥有的: ``` ConfigurationChange | where dayofweek(datetime_add('hour', -5, TimeGenerated)) != 4d and hourofday(datetime_add('hour', -5, TimeGenerated)) !in(0, 1) //

标签: datetime configuration azure-data-explorer


【解决方案1】:

尝试使用dayofweek()hourofday() 添加以下过滤器。

注意:以下示例适用于 UTC。您可以将 UTC -> EST 的当前偏移量添加到 TimeGenerated 作为过滤器的一部分

ConfigurationChange
| where dayofweek(TimeGenerated) != 6d and hourofday(TimeGenerated) !in(0, 1) // <---
| where ConfigChangeType in ("Files")
| where FileSystemPath contains ".config"
| sort by TimeGenerated
| render table

【讨论】:

  • 谢谢,这帮助我指明了正确的方向。为了得到我需要的东西,这就是我登陆的地方:ConfigurationChange | where dayofweek(datetime_add('hour',-5, TimeGenerated)) != 4d and hourofday(datetime_add('hour',-5,TimeGenerated)) !in(0, 1) //
猜你喜欢
  • 2021-04-15
  • 2022-01-14
  • 2014-05-07
  • 2013-03-18
  • 2012-07-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多