input {
stdin {
}
beats {
port => 5044
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
}
}
}
filter {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:eventtime} %{LOGLEVEL:level}" ]
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => "127.0.0.1:9200"
index => "%{[fields][src]}-%{+YYYY.MM.dd}"
user => "root"
password => "123456"
}
}
其中user和password是es创建的user.
[fields][src]是我filebeat的加的字段属性,标识日志的来源信息.
match是指匹配日志进行解析,目前只匹配时间和日志等级,其他记录到默认字段message.
multiline主要为了匹配打印的错误堆栈到一行里边。目前存在的问题最后一行必须等下次输入才会传递到es.