为什么这个提取的 Graylog 字段没有显示在我的小部件中?

问题描述

我正在使用连接到 .csv 文档的管道,在 Graylog 上的 Windows 日志中创建一个新字段。 正如您从屏幕截图中看到的,我可以在每个日志中看到该字段,但是当我单击 显示最高值” 以创建一个新小部件时,Graylog 没有显示任何内容

我认为这是因为字段中的值不是字符串,实际上它位于大括号之间。 问题是我找不到在小部件中显示这些值的方法。我尝试更改我的管道规则,但没有结果。

以下是我对规则所做的众多尝试之一:

rule "eventid_windows_rule"

when

  has_field("winlogbeat_winlog_event_id")

then

let winlogbeat_winlog_italiano = lookup("eventid_widget_windows_lookup",($message.winlogbeat_winlog_event_id));

set_field("winlogbeat_winlog_ita",to_string(winlogbeat_winlog_italiano));

end

截图:

enter image description here

解决方法

这是一个JSON对象的字符串表示,你应该尝试替换

set_field("winlogbeat_winlog_ita",to_string(winlogbeat_winlog_italiano));

set_field("winlogbeat_winlog_ita",to_string(winlogbeat_winlog_italiano.value));
                                                                         /\
-------------------------------------------------------------------------|

这应该避免存储 JSON 对象表示(我们希望在 winlogbeat_winlog_ita 中看到“Un account ha effettuato il logon con succcesso”)

但是,这可能不是您唯一的问题,请检查字段类型是否不是“复合”:如果过去您在该字段中为当前索引发送了另一种数据类型,则可能会发生这种情况。

了解您是否属于这种情况的最佳方法是单击“字段”(在侧栏中,搜索时),然后单击字段 winlogbeat_winlog_ita 并看到弹出窗口显示“winlogbeat_winlog_ita =字符串”或者是否显示混合字段类型。
如果是复合值,您应该轮换活动写入索引,生成一些日志,然后再次搜索(从您执行轮换的日期/时间开始搜索,以避免考虑旧的复合值)