在 Logstash 中增加一个整数字段

Increment a integer field in Logstash

我正在使用 logstash 将日志上传到 elasticsearch。我可以在我的 .conf 文件中增加一个字段吗?

比如我有一个字段'count = 0;' 我希望在满足某些条件时将它增加到 1。

谢谢!

在为 elasticsearch 编写输出配置时,您需要指定

"script=>script_name"
"script_lang=>groovy" (if you are using groovy)

并编写一个脚本来检查您的条件并在条件满足时更新字段。你可以在elasticsearch中查看Event Dependent Configuration and script选项以供参考。