如何将子 json 对象转发到 splunk 索引器



我的应用程序将日志数据写入磁盘文件。日志数据为单行 json,如下所示。我使用 splunker-forwarder 将日志发送到 splunk 索引器

{">

line":{"level": "info","message": "data is correct","timestamp": "2017-08-01T11:35:30.375Z"},"source": "std"}

我只想将子 json 对象{"level": "info","message": "data is correct","timestamp": "2017-08-01T11:35:30.375Z"}发送到 splunk 索引器,而不是整个 json。我应该如何配置 splunk 转发器或 splunk 索引器?

可以使用sedcmd在索引器将数据写入磁盘之前删除数据。

将此添加到您的props.conf

[Yoursourcetype]
#...Other configurations...
SEDCMD-removejson = s/(.+):{/g

这是一个索引时间设置,因此您需要重新启动 splunkd 才能使更改生效

最新更新