0

像这样:timestamp > now - and timestamp < now + 因此,如果消息不在未来或过去太多。

我尝试使用管道执行此操作,但我无法获得时间戳并添加几秒钟,并且无法根据消息中的时间戳检查时间。管道的想法是在时间不正确时检查并编写一个新字段,并创建一个搜索该字段的警报

4

1 回答 1

0

试试这个管道规则,如果时间戳低于或高于服务器时间 1 小时,则插入新字段:

rule "check wrong timestamp"
when
    parse_date(value: to_string($message.timestamp), pattern: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - seconds(3600) > now() || 
    parse_date(value: to_string($message.timestamp), pattern: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + seconds(3600) < now()
then
  //set_field("timestamp", now()); // uncomment if want to fix timestamp
  set_field("timestamp_problem", "true");
end
于 2020-08-10T13:23:06.507 回答