如何使用 Logstash 转换数组中的所有值?
我通过 Logstash 在 ELasticsearch 中索引日志,其中包含一个带有代码数组的字段,例如:
indicator.codes : [ "3", "120", "148" ]
Logstash 中是否有某种方法可以在 csv 中查找这些代码并将类别和描述保存在 2 个新字段中,例如 Indicator.categories
和 indicator.descriptions
。
具有 3 列的 csv 子集:
Column 1 => indicator.code
Column 2 => indicator.category
Column 3 => indicator.description
3;Hiding;There are signs in the header
4;Hiding;This binary might try to schedule a task
34;General;This is a 7zip selfextracting file
120;General;This is a selfextracting RAR file
121;General;This binary tries to run as a service
148;Stealthiness;This binary uses tunnel traffic
我一直在查看 csv 过滤器和翻译过滤器,但它们似乎无法查找多个键。
翻译过滤器< /a> 似乎只适用于 2 列。 csv 过滤器< /a> 似乎无法循环 indicator.codes
数组。
I'm indexing logs in ELasticsearch through Logstash which contain a field with an array of codes, for example:
indicator.codes : [ "3", "120", "148" ]
Is there some way in Logstash to lookup these codes in a csv and save the categories and descriptions in 2 new fields such as indicator.categories
and indicator.descriptions
.
A subset of the csv with 3 columns:
Column 1 => indicator.code
Column 2 => indicator.category
Column 3 => indicator.description
3;Hiding;There are signs in the header
4;Hiding;This binary might try to schedule a task
34;General;This is a 7zip selfextracting file
120;General;This is a selfextracting RAR file
121;General;This binary tries to run as a service
148;Stealthiness;This binary uses tunnel traffic
I've been looking at the csv filter and the translate filter, but they do not seem to be able to lookup multiple keys.
The translate filter seems to work only with 2 columns. The csv filter seems unable to loop through the indicator.codes
array.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 Ruby 过滤器来循环 Indicator.codes 并将它们与从 csv 检索到的数据进行比较。
https://www.elastic.co/guide/ en/logstash/8.1/plugins-filters-ruby.html
I would suggest using a Ruby filter to loop over the indicator.codes and compare them to your data you retrieved from the csv.
https://www.elastic.co/guide/en/logstash/8.1/plugins-filters-ruby.html