我正在使用logstash来解析我的日志。当我解析json(包含“message”字段)时会覆盖默认的消息字段。我尝试使用json {}过滤器的remove_field选项,但这对我不起作用。
这是我的过滤器代码:
filter {
mutate {
gsub => ["message", "\"", "'"]
}
mutate {
gsub => ["message", ".", "_"]
}
csv {
columns => ["TIMESTAMP", "HEADERS", "FIELD1", "FIELD2", "FIELD2_TIME", "INTER_FIELD2"]
separator => "|"
}
mutate {
gsub => ["FIELD1", "'", '"']
}
#Removing message field inside FIELD1 json to avoid overriding
json {
source => "FIELD1"
remove_field => ["message"]
}
mutate {
gsub => ["FIELD2", "'", '"']
}
json {
source => "FIELD2"
remove_field => ["message"]
}
}
如何避免覆盖defaultmessage字段?
答案 0 :(得分:0)
有两种选择: