gpt4 book ai didi

logstash - 如何从消息字段中删除尾随换行符

转载 作者:行者123 更新时间:2023-12-04 08:41:34 25 4
gpt4 key购买 nike

我正在将带有 Logstash 的 Glassfish 4 日志文件发送到 ElasticSearch 接收器。如何使用 Logstash 从消息字段中删除结尾的换行符?

我的事件是这样的:

{
"@timestamp" => "2013-11-21T13:29:33.081Z",
"message" => "[2013-11-21T13:29:32.577+0000] [glassfish 4.0] [INFO] [] [javax.resourceadapter.mqjmsra.lifecycle] [tid: _ThreadID=142 _ThreadName=Thread-43] [timeMillis: 1385040572577] [levelValue: 800] [[\n MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter stopped.]]\n",
"@version" => "1",
"tags" => ["multiline", "date_filtered"],
"host" => "myhost",
"path" => "../server.log"
}

最佳答案

第二种解决方案是使用 mutate filter of Logstash .它允许您去除字段的值。

filter {
# Remove leading and trailing whitspaces (including newline etc. etc.)
mutate {
strip => "message"
}
}

关于logstash - 如何从消息字段中删除尾随换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20122555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com