我正在开发一个插件来根据警报收集事件结果并将其发送到 API 端点。一旦响应成功,端点就会以 JSON 格式返回成功消息,我想将其存储在自定义索引和源类型中。
我尝试使用下面的代码,但数据被写入主索引而不是我的自定义索引。有没有办法通过 Splunk Add-on 构建器将事件写入自定义索引以构建警报操作?
helper.addevent("hello", sourcetype="customsource")
helper.addevent("world", sourcetype="customsource")
helper.writeevents(index="mycustomindex", host="localhost", source="localhost")