[英]Filter logs in logstash and save to Elastic Search
I am dumping all my logs into Elastic Search.我将所有日志都转储到 Elastic Search 中。 It looks like.
看起来像。
Now I want:现在我想要:
log.level:
and save the value INFO/DEBUG/ERROR from the message field.log.level:
并保存消息字段中的值 INFO/DEBUG/ERROR。 Can anyone help me to do that.谁能帮我做到这一点。 I am new to Elastic.
我是弹性新手。
My logstash.conf is我的 logstash.conf 是
input {
beats {
port => 5044
}
}
output {
if [agent][hostname]=="TEST-PC"{
elasticsearch {
hosts => ["localhost:9200"]
manage_template => false
index => "INDEXNAME"
user => "elastic"
password => "password"
}
}
}
Add this filter section to your logstash config file.将此过滤器部分添加到您的 logstash 配置文件中。
filter {
grok {
match => { "message" => "%{TIMESTAMP_ISO8601}\s\[%{NOTSPACE:Meta}\]\s%{WORD:Logtype}\s%{GREEDYDATA:Log_Message}" }
}
if "INFO" in [Logtype] {
drop{}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.