我有一个字符串字段" origin_message"。它非常大(使用多行来获取邮件内容。例如" origin_message":
Delivered-to: somemail@domain.com A LOT OF OTHER CONTENT Subject: Subject goes here AND THE REST OF THE MESSAGE
期望的结果:
Subject goes here AND THE REST OF THE MESSAGE
有没有办法在#34之前修剪一切;主题:"短语?
我尝试过以下过滤器但没有运气:
filter {
mutate {
add_field => { "original_message" => "%{message}" }
convert => {
"original_message" => "string"
}
gsub => [
"original_message", "^(.*)Subject", " "
]
}
}
答案 0 :(得分:1)
不确定为什么,但在"消息"上使用gsub复制之前的字段以分隔" original_message"领域解决了这个问题。
filter {
mutate {
gsub => ["message", "^(.*)Subject", " "]
add_field => { "original_message" => "%{message}" }
convert => {
"original_message" => "string"
}
}
}
@Val,谢谢你的验证。问题似乎与模式无关。